Firebase如何处理linkWithCredential"ERROR_CREDENTIAL_ALREADY_IN_USE";在Android中 [英] Firebase how to handle linkWithCredential "ERROR_CREDENTIAL_ALREADY_IN_USE" in android

查看:114
本文介绍了Firebase如何处理linkWithCredential"ERROR_CREDENTIAL_ALREADY_IN_USE";在Android中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,这是我得到的错误:

OK here is the error I get:

1-当应用程序以phone1开头时,用户匿名登录. Uid:ABC( link1 )

1- When the app starts with phone1, user sign In Anonymously. Uid:ABC (link1)

2- phone1用户决定使用Google登录进行登录.用户已经拥有一个Uid:ABC,因此该用户已通过Google登录从匿名帐户转换为永久帐户. ( link2 )

2- phone1 user decides to login with Google Sign-In. User already has an Uid:ABC, so that User is converted from anonymous account to a permanent account with google sign-in. (link2)

3-使用phone2,该应用程序将首次启动并匿名登录. Uid:ZYX( link1 )

3- With phone2, the app is launched first time and sign in Anonymously. Uid:ZYX (link1)

4-使用phone2,用户希望使用相同的Google帐户登录.因此,此时使用linkWithCredential会导致"ERROR_CREDENTIAL_ALREADY_IN_USE". ( link2 )

4- With phone2, user wants to login with same google account. So at this point using linkWithCredential cause "ERROR_CREDENTIAL_ALREADY_IN_USE". (link2)

那么该问题的正确解决方案是什么?

So what is the proper solution for this issue?

推荐答案

您正尝试 链接 两个具有相同身份验证凭据的UID ,即使用相同的Google帐户.这本身就是主要的安全漏洞,是绝对不能在生产应用程序中完成的事情.

You are trying to link Two UIDs with Same Auth Credentials i.e with same google account. Which in itself is major security flaw and something that should never be done in a production app.

根据Firebase官方文档

According to firebase official docs

尝试链接用户

ERROR_CREDENTIAL_ALREADY_IN_USE 对应于另一个帐户已在使用中的AuthCredential

ERROR_CREDENTIAL_ALREADY_IN_USE when trying to link a user with an AuthCredential corresponding to another account already in use

您宁可尝试简单地登录-,它就会起作用.您的当前操作等同于注册".

You should rather try to simply Sign - In and it will work. Your current action is equivalent to Sign - Up.

请参阅这些文档,以获取正确的Google登录实现.为了您的上述程序正常工作. 您首先必须删除以前的用户,以便删除链接到gmail帐户的旧UID .

Please refer to these docs for proper google sign-in implementation. For your above procedure to work. You will first have to delete previous user so that old UID linked to the gmail account get's deleted.

请告诉我该信息是否对您有帮助.

Do let me know if this info helps you.

这篇关于Firebase如何处理linkWithCredential"ERROR_CREDENTIAL_ALREADY_IN_USE";在Android中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆