Ios, logging out of Facebook and clearing user tokens

I am working on an application for iOS5 and iOS6 that uses Facebook sdk "3.2.1". Is there a way to register the user and clear the token so that when the login button is pressed again, the user is forced to enter his username and password again?

I am using [FBSession.activeSession closeAndClearTokenInformation]; , which does not seem to clear the token information, since after pressing the login button the safari will display

"you have already authorized your application. click" OK "to continue"

which is not the behavior that I need.

+1
source share
1 answer

What you see is not that the SDK does not clear the token information - the SDK really cleared the token. The information that allows you to see the message "you are already logged in ..." belongs to Facebook. In the settings of the user application, they have an authorization parameter from your application that you asked for when they first logged in.

To revoke permissions from your application, you need to touch the Graph API. FB, in the "Delete" section https://developers.facebook.com/docs/reference/api/user/

You can revoke the authorization of the application or revoke the specific extended permissions on behalf of the user by issuing an HTTP DELETE request for PROFILE_ID / permission with the user access_token for this application.

I assume that you know how to send Graph API requests using the SDK, let me know if not.

+5
source

Source: https://habr.com/ru/post/1202908/


All Articles