Linking custom auth provider with Firebase

2019-06-26 11:48发布

I read that with Firebase I can allow users to sign in to my app using multiple authentication providers by linking auth provider credentials to an existing user account. Is possible linking custom auth provider such as Linkedin? I read that I need to pass the AuthCredential object to the signed-in user's linkWithCredential method but I don't find a custom AuthCredential.

1条回答
叼着烟拽天下
2楼-- · 2019-06-26 11:59

One way to link an unsupported provider custom token to an existing account is to get the Firebase account's user id and the unsupported provider user id and save a hash map that takes in the unsupported provider id and returns the firebase uid which you want to link to. When the user signs in to unsupported provider with custom token, you get the corresponding firebase uid from the map and return a custom token with that uid which on signInWithCustomToken resolves with the original firebase user.

The downside is that you don't see the unsupported provider in the list of provider data within the user. You also need to store the map.

查看更多
登录 后发表回答