Any way to pull out session key from access token returned by Facebook iOS SDK?

后端 未结 2 752
刺人心
刺人心 2021-01-03 12:58

I need Facebook session key to be used in this senario: http://developers.facebook.com/docs/chat/#platauth

However, the current Facebook iOS SDK returned us a access

2条回答
  •  粉色の甜心
    2021-01-03 13:29

    I still dont have the formula to convert FBAppAuth-ed or SafariAuth-ed access_token fragments to session_id. However, the following description will help in getting an access_token in described formula which can then be easily fragmented to derive session_id. Hope this helps.

    In iOS SDK Version 2, login is handled by following API in Facebook class:

    - (void)authorize:(NSArray *)permissions delegate:(id)delegate;
    


    In the implementation of same API, if we turn off the FBAppAuth and SafariAuth, then it will invoke login dialog box and the returned access_token will be of format APP_ID | SESSION_KEY | DIGEST

    - (void)authorize:(NSArray *)permissions delegate:(id)delegate 
    {
      [_permissions release];
      _permissions = [permissions retain];
      _sessionDelegate = delegate;
        //[self authorizeWithFBAppAuth:YES safariAuth:YES];
      [self authorizeWithFBAppAuth:NO safariAuth:NO]; // Turned off FBApp and Safari auth
    }
    


    The returned access_token can be captured in following call back method in Facebook class (please put a NSLog to print the token) :

    - (void)fbDialogLogin:(NSString *)token expirationDate:(NSDate *)expirationDate 
    


提交回复
热议问题