如果用户不退出 Facebook,则无法退出我的 Facebook OAuth 会话 [英] Can't Logout of my Facebook OAuth Session without logging User Out of Facebook

查看:21
本文介绍了如果用户不退出 Facebook,则无法退出我的 Facebook OAuth 会话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据 SDK,我使用带有重定向的 logout.php:

Per the SDK, I am using the logout.php with redirect:

https://www.facebook.com/logout.php?confirm=1&next={SOME URL}&access_token={ACCESSTOKEN}

它可以很好地将我注销,但也会将用户从 Facebook 注销.有没有办法在不退出 Facebook 的情况下退出我的 OAuth 会话?

It is logging me out fine, but it's also logging the user out of facebook. Isn't there a way of logging out of my OAuth session without logging out of facebook?

推荐答案

是的,我自己也遇到了同样的问题.不要做 logout.php 或 JS SDK 的 FB.logout().而是使用 HTTP 删除命令调用图形 API 到 me/permissions.这将杀死访问令牌,从用户的应用程序列表中删除该应用程序,并为 facebook 维护他们的浏览器 cookie.您可以将其称为服务器端或客户端.这是客户端 Javascript SDK 方式:

Yes, I ran into this same issue myself. Dont do logout.php or JS SDK's FB.logout(). Rather call the Graph API with an HTTP Delete command to me/permissions. That will kill the access token, remove the app from the user's app listing and maintain their browser's cookie for facebook. You can call it either server side or client side. Here's the client side Javascript SDK way:

FB.api("me/permissions","delete", function(response){/*do something if you want*/})

这篇关于如果用户不退出 Facebook,则无法退出我的 Facebook OAuth 会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆