FBSDKLoginManager works, PFFacebookUtils logInInBackgroundWithReadPermissions not

169 Views Asked by At

I implemented the login via Facebook with parse server.

If I use this, I get user information correctly:

FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];
[login
 logInWithReadPermissions: @[@"public_profile",@"email"]
 fromViewController:self
 handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {
     if (error) {
         NSLog(@"Process error");
     } else if (result.isCancelled) {
         NSLog(@"Cancelled");
     } else {
         NSLog(@"Logged in %@",result);
         [self fetchUserInfo];
     }
 }];

but I want to use PFFacebookUtils for easy user creation in Parse:

[PFFacebookUtils logInInBackgroundWithReadPermissions:@[@"public_profile",@"email"] block:^(PFUser *user, NSError *error) {
    if (!user) {
        //...
    } else if (user.isNew) {
        //...
    } else {
        //...
    }
}];

The Facebook modal appears with the authorization request, but when I press ok, I get this error:

[Error]: Facebook auth is invalid for this user. (Code: 101, Version: 1.13.0).

Inside the applications settings on Facebook, the app there.

1

There are 1 best solutions below

0
On

It occurs in Parse app when the user changed Facebook password or removed your app in the applications settings on Facebook.

User.authData should be updated with PFFacebookUtils.logInInBackgroundWithReadPermissions:, but it seems to be not updated. I think that this is problem of Parse Server.

Workaround: When that error occurred, you can update User.authData with PFFacebookUtils.linkUserInBackground:withReadPermissions:.