koool
koool

Reputation: 15517

How could I authenticate a user in facebook using oauth?

I want to know how could I authenticate a user, visiting my site, for facebook using oAuth 2.0

Upvotes: 1

Views: 938

Answers (1)

Joey Schluchter
Joey Schluchter

Reputation: 2612

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.

Upvotes: 1

Related Questions