react-native-firebase - 链接帐户时如何从“auth/credential-already-in-use”错误中恢复
问题描述
遵循本指南: https ://firebase.google.com/docs/auth/web/account-linking 在我的网络应用程序中,我能够毫无问题地将两个帐户合并为一个,但是当我尝试在我的移动应用:
//action to recover from the 'auth/credential-already-in-use'
// Get reference to the currently signed-in user
const { currentUser } = firebase.auth();
var prevUser = currentUser;
// Sign in user with another account
firebase.auth().signInAndRetrieveDataWithCredential(linkError.credential).then((userCredential) => {
console.log("Sign In Success", userCredential.user);
var newUser = userCredential.user;
// Merge prevUser and newUser data stored in Firebase.
// Note: How you handle this is specific to your application
// After data is migrated delete the duplicate user
return newUser.delete().then(() => {
// Link the OAuth Credential to original account
return prevUser.linkAndRetrieveDataWithCredential(linkError.credential);
}).then(() => {
// Sign in with the newly linked credential
return firebase.auth().signInAndRetrieveDataWithCredential(linkError.credential).then(() => {
return dispatch(mergeAccountsCompleted())
})
});
})
prevUser.linkAndRetrieveDataWithCredential 的执行失败并显示错误代码:'auth/no-current-user' 我找不到此错误的文档。所以我的问题是,当我想合并 react-native-firebase 中的现有帐户时,如何从 auth/credential-already-in-use 错误中恢复?
提前致谢 !
解决方案
对此感到抱歉 - 由于我在 GitHub 上的问题评论中描述的困难,我们不得不放弃对错误对象的凭据的支持。
但是,我们有一些计划,最早将作为 v5.0.0 版本的一部分实施,或者最迟在 v5.1.0 版本中实施。
订阅上面链接的问题,我将在获得支持后更新并关闭它。
推荐阅读
- c++ - 由于用于构建 GCC 的 CPU 的体系结构,这是 g++ 的“非法指令错误”吗?
- perforce - 是否可以在 unix 和 windows 机器上使用 perforce 工作区?
- jquery - 删除 jQuery 中的 DOM 元素
- python - 规划器返回错误:无法找到 $geoNear 查询 Python 的索引
- c++ - 将 LinkedList 作为元素链接到不同的 LinkedList
- reactjs - 在 React 中渲染列表并得到 Eslint 错误“没有未使用的表达式”
- android - Android 房间关系——外键列表
- linux - scp 文件从多个节点到一个节点并在其他节点上删除它们
- actionscript-3 - Animate CC AS3 如何在写入文件时管理数据
- c++-winrt - 如何使用 ReadBufferAsync 在 winrt 中读取文件的所有字节?