开发者

Facebook SDK no autologin wanted!

Im using Facebook's SDK for my site so users can login with their FB account. The problem is that if they are logged into FB and go to my site, the get auto logged in(only if they have accepted to use it on my site.)

Is it possible to make it so they ha开发者_Python百科ve to press the login button if they want to login?


This sounds like a behavior derived from a cookie that's persisting. Maybe they're not getting auto-logged in, but rather they are still logged in from last time.

I don't know what your code looks like, but try running FB.getLoginStatus() when the page is visited and the authResponse object is not null then there's an active cookie showing the user to be both authorized for the app and currently logged in. You could

FB.getLoginStatus(function (response) {
    if (response.authResponse) {
        // take whatever action you want
    }
});

Facebook lets you ask 'offline' permission from users which would be a cookie that never expires; it sounds like you want one that expires as soon as the user closes their browser and I don't know if FB currently gives us a way to control that, but I don't think so.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜