Call facebook exit ios sdk does not clear user credentials

When implementing the single sign-on function on facebook, calling the exit function on facebook ios sdk does not clear the user credentials and does not request a login next time.

+4
source share
2 answers

I used Graph Api .....

- (IBAction)loginButtonPressed:(id)sender { NSString *client_id = @"dsfgdgfgfgdfgvdfg"; //alloc and initalize our FbGraph instance self.fbGraph = [[FbGraph alloc] initWithFbClientID:client_id]; //begin the authentication process..... [fbGraph authenticateUserWithCallbackObject:self andSelector:@selector(fbGraphCallback:) andExtendedPermissions:@"user_photos,user_videos,publish_stream,offline_access,user_checkins,friends_checkins"]; } - (void)logOutButtonPressed { NSLog(@"logout"); fbGraph.accessToken = nil; NSHTTPCookie *cookie; NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage]; for (cookie in [storage cookies]) { NSString* domainName = [cookie domain]; NSRange domainRange = [domainName rangeOfString:@"facebook"]; if(domainRange.length > 0) { [storage deleteCookie:cookie]; } } [self loginButtonPressed:nil]; } 

And this code WORKS IN THAT THIS

+9
source

I experienced the same thing, but I think this is not a mistake, but a confusing one.

Facebook places a cookie in a mobile safari that refers to a valid session or, possibly, an access token. If you log out of Facebook, it clears the access token and all cookies of the web browser that are not used in mobile safari. In fact, you cannot do this by code. Now, if you return and the mobile safari opens, there is still a valid session and you are logged in again without entering credentials.

You can specify an error to see if Facebook can invalidate the access token server side.

0
source

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


All Articles