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
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
}
}];
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With