Where facebook saves an infomation about registered users? - facebook

I am trying to integrate my site with FB. So I have begun with registration plugin. My question is: where FB is saving the registered data, because when I am already registered on my site via FB registration plugin and viewing registration form again FB informs me that I am already registered. I could not find any information about it in user profile or in my app panel.
Thx for advise. If something is not clear I will be glad to explain my problem once again.

Check out the signed_request that Facebook is sending to your app via the redirect_uri (which is a page somewhere within your Site URL). It will have the encoded information for that user.

When you say "integrate my site with FB", I assume you mean "let people authenticate on my site by authenticating on Facebook ?".
I think there is all the info there :
https://developers.facebook.com/docs/guides/web/#login
https://developers.facebook.com/docs/authentication
EDIT : regarding the "http://developers.facebook.com/docs/plugins/registration/" example ; I can not say it authoritavely since I don't have the code, but I think what happens is that :
The registration form is in a iframe, showing a page that is generated on the server side (maybe, your server)
If you are not logged in, the form is not filled
There is a "login with facebook" that opens a pop-up with a page (from Facebook site) that has an extra param called "redirect-url" ; this will be a url or your site
When the user enters it's credentials, on the registration form that is posted to Facebook, they check the username/password, and when done, they call the "redirect-url" (again, a URL from your site) and pass the info in this (in this case, the redirect is configured to get a number of fields (name, birthday, location, etc...)
Your site gets the info in the form of a "signed_request" (see the section "Reading the Data"). In this case, it will render the same "Registration" page, except I would guess that on the server-side, some fields have been filled with the info provided by FB's signed_request.
The trick is that in this example, everything happens in an iframe - I'm not sure how this is mandatory.
Now, about the question "If I am already logged in FB, and I go to the Registration form, how does my info get in the form ?", I can only suppose that FB sets a number of cookies when you log in, that client site can use - but I agree with you that the documentation is not extremely clear about that. Probably, it's suppose to be hidden by FB's API, but the doc does clearly point to which one (at least on this page).
Again, I'm just speculating from the doc and tinkering with the requests made on the pages (and experience with similar oauth-y authentication schemes) ; hopefully someone with an actual application can give you more info.
Hoping this helped - sorry if it did not. Good luck with your dev.
PH

Related

How to get user likes in Facebook before asking permissions

I have a client who wants to have the user liked his app before asking for permissions.
For users not having defined advanced security settings in their profiles this is possible, but I have occasions that I must ask for user_likes permissions to get that info so this is a dead end.
One solution could be to have my own like button in the page and register FB.event.subsribe to collect the info, but because the app will be used in a page tab (where a like button is already displayed by FB on top) this would be ugly and confusing.
Any ideas?
Within a page tab app, you get the info whether the viewing user liked the page already or not in the signed_request. (Since it is POSTed to your app on initial load into the iframe, you can only access it server-side.)
For how to parse it, see here: https://developers.facebook.com/docs/facebook-login/using-login-with-games#parsingsr
(If you are using the PHP SDK, that has a method to get it parsed implemented already.)

Posting to a Facebook page on behalf of page using a Facebook application by anyone

I have a web page linked to a Facebook application where users can log in by their Facebook account.
I have also a Facebook page for my application where anybody can post.
What I'd like to achieve is the following:
- An ordinary user logs in to my web page using her Facebook account,
- She adds an information to my web page (for example a book name),
- That information is instantly posted to my application Facebook page under page's name (for example "this book is read by someone").
I don't want it to be posted by the user, I don't want it to be posted by myself (admin of the page).
I don't want to mention about the user, it will be anonymous information.
But I couldn't find a way to do it either as JS or PHP.
Any suggestion is welcome.
Many thanks.
You will need to get a page access token. https://developers.facebook.com/docs/facebook-login/access-tokens/
Get it, store it somewhere on your server – and then use it when making the API call to post what the user entered.

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...

Facebook API Registration

1)If two users(A & B) logs into the website(http://site.com). Both(A & B) have registered in the website with normal user registration (not FB register). Both(A & B) will have access to all parts of the site with all user provisions.They can write their reviews in the website and can do so and so.This is happening right now.
Note:Let us assume the users A and B are already friends in the Facebook.But they don't know each other in our website.
2)If two users(X & Y) logs into the website. Both(X & Y) have registered in the website with facebook registration. Both(X & Y) will have access to all parts of the site with all user provisions.They can write their reviews in the website and can do so and so.This is happening right now.
Note:Let us assume the users X and Y are already friends in the Facebook.But they don't know each other in our website.
What i am going to do:
a)If the user A logs into the system, we need to show facebook login button in some page to link his facebook account. If he wish to link , he need to give his FB login details,then we need to show the friends of him who are all also the users of my website. He may have so many friends with his facebook account, but in this part we need to show B details because he is already user of the site and also his facebook friend as we stated above.
If the user A has someother facebook friends(D,E,F) who are also registered users in our site then we will need to show all of those user details with their recent activity in the website under his FB linking page.
2)This is the samething need to do for FB registered users(X,Y) also.(Similar to http://runkeeper.com)
Technical Agenda:
1)First type of user(A,B):
During the linking of facebook(facebook login), we are going to update the user table row values with his facebook details and then we need to show his FB friends activity in the website by using the FB session data created for his/her FB login and now i will be able to show his Friendslist.
Problem:
The same user(A or B) logout from the website and relogin with his user login details. In the user table we already having his facebook id details, using that we need to show all of his FB friends. The Facebook api uses the Session value to show the datas with the api call like $frnd=$facebook->api('/me').Now there is no session for this user.
Please suggest me anyway to come up with this technical part , because there is no clear documentation to follow .
2)Second type of user(X,Y):
They are going to login with the existing FB details to the site, we need to just show there FB friend activity in the website.
This is definitely possible as you describe. What web platform are you using for your site. PHP, ASP.NET, or another? As you have experienced, the documentation is sometimes lacking. If you are using php, it will likely be a little easier to get everything working, because the examples all seem to be in php.
I will have to give you a more detailed answer tomorrow, but I will need to know which platform you are using for your website. Also, it wasn't very clear to me, did you say that users are already logging in to your site using facebook authentication?
Eric

post content to facebook to users' wall?

i've built a survey and at the end i want the users to share their result on their facebook wall but i'm finding it hard to find any examples or reference.
something like;
<div>
[ image/graphic ]
"I've just completed survey XXX and got 90%"
<a>post on my wall</a>
</div>
any help appreciated - even if its just terminology i can look up!
Start here. Basically, you're creating a website which you want to integrate into Facebook. To do so, your users will need to "login to Facebook" from your site (unless they're already logged in, such as in another browser tab) and allow your site to perform certain actions on Facebook on their behalf.
The Single Sign-On part is where you will initialize your website as a Facebook application (you'll need to create the application on Facebook first) and provide a login button for your users.
Your login button can be set up to ask the user for specific permissions to act on their behalf with Facebook. I think the one you want is publish-stream but I'm only barely familiar with it, play around with the functionality and see what works best for you. Your users will be presented with a pop-up div stating that your website (or application) is requesting these specific permissions and they have the option to allow or deny. An example can be seen here.
Once you have the user's permission, you make use of the cookie (demonstrated using PHP back on the Single Sign-On link) to gain access to information by use of the Graph API, the JavaScript SDK, Social Plugins, etc.
you should use the facebook api.
Get the "publish_stream" right of a user and use the "api" method of the connection object (with parameters like : '/userid/feed', 'post', array of informations about the post).
I can't find the right code and the official document is not always up-to-date.
OR
Just add a facebook "share" button on your page that uses "meta" markups. You should find examples on about 80% of websites.