开发者

How could I authenticate a user in facebook using oauth?

开发者 https://www.devze.com 2023-03-01 04:56 出处:网络
I want to know how could I authentic开发者_运维知识库ate a user, visiting my site, for facebook using oAuth 2.0You can use the javascript sdk.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消