ios, Facebook logout AND clear user tokens

别来无恙 提交于 2019-12-06 14:13:47

问题


I'm working on an app for iOS5 and iOS6 which makes use of Facebook sdk "3.2.1". is there a way to log the user out and clear the token so that when the login button is pressed again, the user will be forced to enter his username and password again?

I use [FBSession.activeSession closeAndClearTokenInformation]; which doesn't seem to be clearing the token information as when the login button is pressed after it, safari will show

"you have already authorized 'your app'. press "Okay" to continue"

which is not the behavior I need.


回答1:


What you're seeing is not the SDK 'not clearing the token information' - the SDK has indeed cleared the token. The information that allows you to see the 'you have already authorized...' message lies with Facebook. In the user's app settings, they have an authorization setting from your app, which you asked for when they first logged in.

In order to revoke permissions from your app, you will need to touch the Graph API. FB docs, in the 'Delete' section of https://developers.facebook.com/docs/reference/api/user/

You can de-authorize an application or revoke a specific extended permissions on behalf of a user by issuing an HTTP DELETE request to PROFILE_ID/permissions with a user access_token for that app.

I'm assuming you know how to post Graph API requests using the SDK, let me know if not.



来源:https://stackoverflow.com/questions/15999536/ios-facebook-logout-and-clear-user-tokens

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!