Automatically like a page in Facebook based on user long live token - facebook

As the title reads...
is this possibly?
Workflow should be like:
1.- User is registered, he receives a barcode with a numeric ID.
2.- Time later the user scans barcode in embedded device, it posts the numeric ID to some php magic... and he automatically is noted as "liking" (user likes x) a certain page, no login, no nothing, we should get the user data just based on our first registration. The (embedded device/computer/thing that reads barcodes) must be headless.
Is this even possibly with the current Facebook oAuth model??
Thanks in advance.

It is not allowed as the terms of service now.

Related

Facebook Graph API Events ticket_uri not working

When fetching a Facebook event from the Facebook Graph API, there is a field for the ticket_uri
The response always looks like this:
https://www.facebook.com/ajax/events/ticket.php?event_id=1461866457391623&source=12&ext=[aBigNumber]&hash=[randomhash]
which basically works in the current browser session, but does not work when saved and used somewhere else, like an other browser.
Is there a solution to redirect the user to the correct "Book now" url
That's the intended operation of that field - It's intended to be used by the current session user (i,e whose access token you're using) and contains a user/session specific hash which will expire -
If you want to link arbitrary other users (i.e. who aren't using your app) to the event for ticket purchasing reasons, the only alternative is to link them to the Event on Facebook.com and have them click it themselves

List Facebook Page events on website for a Venue using FQL or Graph API

I am helping out a friend with a site for a venue that lists all events on FB with a location, ticket URI, time, etc.
I have found lots of info on how to get the data, but what I am unclear on is how to get public events without being logged in to FB.
What type of tokens do I need to have a website simply pull events data and display it to visitors?
Basically, what I am attempting to do is show a set number of upcoming events and assume that the visitors to the site are not logged in to FB.
On this page, https://developers.facebook.com/docs/reference/fql/event, it says this:
Permissions
To read the event table you need:
a generic access_token for public events (those whose privacy is set to OPEN)
a user access_token with user_events permission for a user who can see the event for non-public events
an app access_token with user_events permission (for non-public events, must be the app that created the event)
a page access_token with user_events permission (for non-public events, must be the page that created the event)
I am not looking to get help with the code really, I am just having trouble figuring out how the access/auth process works.
It appears FQL may be the best option so I can do queries based on date ranges, but alas, I am stuck on the access/auth/token part.
What do I need to have in place to be able to list a Page's events on a 3rd party site?
If anyone has any advice there, I would appreciate it. Thanks.
Just to explain to others, you cannot get ALL the events in the city by graph search. You need to refine it either by user details or some other metric.
I figured it out.
This question helped, but was not correct and there is a syntax error in an answer:
Get Facebook events from public fan page
From what I found, you need to become an FB developer, create an app, get an ID and secret.
Use the SDK (PHP in my case), and this question had a good example of returning the list I want:
Link from ticket_uri is opening a blank page
I am having the same issue though of getting blank pages on the ticket link if the user is not logged into FB.
But my original issue is solved.

Using FB login on a website

I am working on a web based project that allows a user to login using a Facebook login. This part works as expected. However after logging in I want to display non-FB specific content specific to each user. How can I do this efficiently? For testing suppose I want to display a different greeting for each FB user and display a different background after successful login using FB username. Any sample code to play with would be highly appreciated.
I guess it's pretty late to answer yet I would like to. I assume you want to differentiate between the greeting, for example, that gets generated for a core user (one signed up manually through form) and a user logged in using facebook, right? Well, you can store the facebook id of each user and then it would be easy for you to generate messages respectively!

Facebook return ID and me.name

I am really lost with these two problems with Facebook API...
All has been working fine posting to user walls, but I have one client with a page. The page was created from scratch, not via themselves as a user - ie they did not login and create a page they just started from the Facebook welcome screen>create page.
There page works fine, however,
1) Our system is submitting a post via API and receiving an ID in return (eg {"id":"123456_123456"} back from Facebook - this tells me facebook has accepted it and has given me an ID for the post.
However, the post DOES NOT appear on the page it relates to (and I have checked where it is submitting it to and it is the correct User ID). This system has been working fine for all other users.
2) When the login occurs via Javascript for this user, we get an empty value for "me.name" (we get me.email etc, just no name)
Is all this normal, or do pages have a different technique to posting and retrieving data?
Email is a private data of facebook user , It is a permission issue what you are encountering
The only way to get the users e-mail address is to request extended permissions on the email field.
After logging in .
This is how facebook api works , w.r.t revealing private data of its users
Ok I solved this one, I don't doubt the ability of anyone here - perhaps my question is still being misunderstood...
Some Facebook pages (especially business pages) where the page hasn't been created by an existing user are different to Facebook groups and user pages. You cannot just submit using an short ot long term access token.
You have to call facebook as http://graph.facebook.com/ID_OF_PAGE/accounts with your token first.
Facebook returns a list of pages, each with their own unique ID and a token for each.
You then grab the token for the page you want then resubmit with the page ID and that pages OWN token - and voila it posts to it!
Their are still bugs with Facebook as I found. It says on one business page I created for a client "Use Facebook as ." - ie the name is missing before the "." - it should say "Use Facebook as MYNAME."
This introduced another problem with the JS FB.login because the name of the person returns undefined. I had to verify their Email instead - other wise it says "You are logged in as ."
I think its because FB lets you create a page from scratch, as a new user, and without logging in as yourself - then some values are not being set and it messes up.
Perhaps may help someone...

How to save Facebook user's data into our own database who like my app, page

Is there any way to save data of Facebook's users into my own database who has liked my applivation on page.
I wanted to know who liked my app, page and want to save those details into my database
you can do it & the way of doing it, depends on
do you mean Like button top of the page or like button like what is for websites ?
please explain more
You can get only a limited amount of data about a person who has liked your page. It is contained within the signed_request parameter that is posted to all facebook tabs when they load.
http://developers.facebook.com/docs/authentication/signed_request/
For an anonymous user who has not authenticated your app, the information you can get is
locale,
country,
age (this is an object containing minimum and maximum age - which you can use to control age restricted content on your page, but which doesn't give you a very accurate user age)
If you want more information than this, you need to authenticate the user with OAuth, and request that they give you permission to access their data - there is plenty of documentation on this.
http://developers.facebook.com/docs/guides/web/#login