Can't Logout of my Facebook OAuth Session without logging User Out of Facebook

后端 未结 2 1801
栀梦
栀梦 2021-01-03 09:13

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}


        
相关标签:
2条回答
  • 2021-01-03 09:25

    This is one of the many annoying things about developing on the Facebook platform. The only way to log out via a browser session is to use their javascript logout function or the redirect like you tried but either will also log the user out of Facebook which is very annoying from a users perspective. The problem is you can't access the cookie they set for your app to delete it due to cross-domain restrictions so you are stuck with the limited options Facebook provides. If you are not prompting for offline_access, you could just forget the users access token and it will expire after an hour. Although the problem still exists that the cookie is still set for within that hour.

    0 讨论(0)
  • 2021-01-03 09:26

    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*/})
    
    0 讨论(0)
提交回复
热议问题