Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parse.com - Another user is already linked to this facebook id

I'm using parse.com's api and trying to link a currently active user to his to facebook account.

I keep bumbing into:

Another user is already linked to this facebook id

As to my question: How do I get the user's connected facebook id? I'd like to switch my current anonymous user with the active and logged in user.

Thank you

like image 841
vondip Avatar asked Apr 14 '13 10:04

vondip


2 Answers

I solved this by logging out the current user then logging in. Works well.

[PFFacebookUtils linkUser:[PFUser currentUser] permissions:permissionsArray block:^(BOOL success, NSError *error) {
    if (!success) {
        if (!error) {
            NSLog(@"User Cancelled");
        } else {
            if(error.code == 208) {
                [PFUser logOut];
                [PFFacebookUtils logInWithPermissions:permissionsArray block:^(PFUser *user, NSError *error) {
                    if(error) {
                        NSLog(@"An error occurred: %@", error);
                    } else {
                        // Carry on
                    }
                }];
            } else {
                NSLog(@"An error occurred: %@", error);
            }
        }
    } else {
        // Carry on
    }
}];
like image 50
JeremyDay Avatar answered Sep 22 '22 13:09

JeremyDay


You can ignore it as it's a warning to notify you that the Facebook account was already linked(In your case it's to the anonymous user), not an error.

The last assigned user will be linked to the Facebook account. So your original intention - " To link the currently active user to his to facebook account" works even though a warning will be raised to notify you that the anonymous user was linked to the same facebook account.

To avoid this warning, always logout the anonymous user before linking Facebook user with the currently active user.

like image 27
Srijith Vijayamohan Avatar answered Sep 20 '22 13:09

Srijith Vijayamohan