开发者

What is the relation between login-button and OAuth 2.0

In Facebook for Websites there is a very shallow explanation on how to use Javascript SDK to add a beautiful "Login with Facebook" button in my site. The reference documentation of the tag fb:login-button is not much better, but at least says I can use it without XFBML, but is not very specific on the details.

On the other hand, the Authentication documentation is very detailed and explains everything I need to know on how to use OAuth system in my website, in a language I can understand very well, talking about HTTP requests and such. But I need a link in开发者_运维知识库 my site that redirects the user to Facebook, instead of the pop-up I get with fb:login-button.

What is the relation of that fb:login-button with the methods explained in the Authentication page? How can I use the button with the popup? How can I set my redirect_uri? How can I have access to the user's id?


If you want to use the pop-up that fb:login-button gives you, you will have to use client-side methods. The Authentication docs are describing a server-side approach. I take it you got the fb:login-button to work as expected, but nothing seems to happen after you log in and the popup disappears? If so, you need to look at adding an api call like this:

FB.Event.subscribe('auth.authResponseChange', function(response) {
alert('The status of the session is: ' + response.status);
});

and you should see that fire when you log in. Of course you will have to modify it do actually do something useful, but I think this is probably the part you are missing.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜