I have successfully implemented email and Facebook login authentication using Firebase. I would now like to allow email users to link their account with Facebook.
I have the following code for this:
let credential = FacebookAuthProvider.credential(withAccessToken: FBSDKAccessToken.current().tokenString)
if let user = Auth.auth().currentUser {
user.link(with: credential, completion: { user, error in
//
})
}
The linking works, but the user returned has no displayName nor photoUrl. Either the user returned in the completion block or when accessing the user via Auth.auth().currentUser.
The user does have a displayName and photoUrl though when authenticating directly with Facebook. Not sure why these properties are nil when linking an account. Any ideas?