Firebase: link with multiple providers

App has 2 social logins available: Facebook and Google

Consider the following flow:

  • app starts and user is given anonymous uid
  • user logs in via Facebook, for email a_email@gmail.com
  • user logs out and is given new anonymous uid
  • user tries to login via Google for a_email@gmail.com
  • FirebaseAuthUserCollisionException: The email address is already in use by another account. exception is thrown by Firebase
  • how can I resolve this exception?

    User is not logged in via Facebook at the moment, so I can't just link him with new Google credentials. I am unable to login him via Google because email is already in use.

    The only possible solution would be to login user via Facebook and then link Facebook to Google, but this would be totally confusing for user – he will fisrt see Google login flow, then, suddenly, will be switched to Facebook, and then back to Google.

    Or, I'll have to just throw an error and explain to the user, that even though email is the same, he has to go and login via Facebook. And I will have to provide new UI to allow users link Facebook to Google after login (at the moment I didn't invest time into that, hoping it's unnecessary)

    链接地址: http://www.djcxy.com/p/32336.html

    上一篇: Firebase手机身份验证凭证与Firebase中的Google登录链接

    下一篇: Firebase:与多个提供商的链接