I want to know how could I authentic开发者_运维知识库ate a user, visiting my site, for facebook using oAuth 2.0
You can use the javascript sdk.
Basically go here: http://developers.facebook.com/docs/reference/javascript/
Add the code to async load the fb all.js
Then authenticating can take many paths... you can do this:
http://developers.facebook.com/docs/reference/javascript/FB.login/
or pass them to here:
https://www.facebook.com/dialog/oauth? client_id=YOUR_APP_ID&redirect_uri=YOUR_URL
The you can make proper graph calls to get any necessary info you need with the graph like so:
FB.api('/me', function(response) { alert(response.name); });
Further information on that is available here: http://developers.facebook.com/docs/reference/javascript/FB.api/
Hope this helps.
精彩评论