How to “rerequest” email permission using Facebook iOS SDK 4.x?

前端 未结 2 1564
野性不改
野性不改 2020-12-11 01:44

I am integrating FacebookSDK 4.x integration with custom UI and using following method to log-in and also getting email permission from user.

FBSDKLoginManag         


        
相关标签:
2条回答
  • 2020-12-11 02:08

    I resolved issue by recalling the method :

    [login logInWithReadPermissions:@[@"email"] handler:^(FBSDKLoginManagerLoginResult *result, NSError *error)

    I need to pass auth_type: 'rerequest' while requesting again and i get it in the documentation of this method i get the description :

    Use this method when asking for read permissions. You should only ask for permissions when they are needed and explain the value to the user. You can inspect the result.declinedPermissions to also provide more information to the user if they decline permissions.

    If [FBSDKAccessToken currentAccessToken] is not nil, it will be treated as a reauthorization for that user and will pass the "rerequest" flag to the login dialog.

    just the problem was i was calling logout Method of FbSDKLoginManager class. This will clear the token and it will takes it as the old permission not re-requested permission.

    0 讨论(0)
  • 2020-12-11 02:14

    You actually don't need to pass or call auth_type:rerequest. This is already done by facebook. If you check FBSDKLoginManager, the code does it for you.

    -(NSDictionary *)logInParametersWithPermissions:(NSSet *)permissions
    {
        if ([FBSDKAccessToken currentAccessToken]) 
           {
                 loginParams[@"auth_type"] = @"rerequest";
           }
    }
    
    0 讨论(0)
提交回复
热议问题