Calling logout function of facebook ios sdk is not clearing user Credentials

℡╲_俬逩灬. 提交于 2019-11-28 12:38:05
iProgrammer

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 is WORKING FINE..TRY THIS

I've experienced the same, however I think it's not a bug, confusing though.

Facebook places a cookie in the mobile safari which refers to a valid session or maybe an access token. If you logout with the Facebook lib it clears the access token and all cookies of the webview used not in mobile safari. Actually you can't do that by code. Now if you come back and mobile safari opens up, there is still a valid session and you are logged in again without entering credentials.

You may file a bug to ask if Facebook can invalidate the access token server side.

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