This is actually quite simple with Firebase. The below code should work and I have also included a link to the documentation describing the process.

let credential = FacebookAuthProvider.credential(withAccessToken: FBSDKAccessToken.current().tokenString) if let user = FIRAuth.auth()?.currentUser { user.link(with: credential) { (user, error) in //perform any actions after the account has been linked } }

Here is a link to the Firebase documentation on the subject: https://firebase.google.com/docs/auth/ios/account-linking