Firebase身份验证导入SHA256哈希:Can';t导入后使用密码登录
我正在尝试迁移用户(使用firebase)-admin@8.13.0)进入firebase auth,请遵循本指南: 在旧系统中,密码是用php散列的:Firebase身份验证导入SHA256哈希:Can';t导入后使用密码登录,firebase,firebase-authentication,Firebase,Firebase Authentication,我正在尝试迁移用户(使用firebase)-admin@8.13.0)进入firebase auth,请遵循本指南: 在旧系统中,密码是用php散列的: $Password = hash('sha256', $Password); 我正在运行以下代码将用户导入firebase: const res = await admin.auth().importUsers([{ uid: 'ABC123', email: 'tester@test.com', passwordHash: B
$Password = hash('sha256', $Password);
我正在运行以下代码将用户导入firebase:
const res = await admin.auth().importUsers([{
uid: 'ABC123',
email: 'tester@test.com',
passwordHash: Buffer.from('5457ae6b180556bc65b423ba3a36124ec44f6cbec7da84e483daa2a46dec3f97')
}], {
hash: {
algorithm: 'SHA256',
rounds: 1
}
});
导入成功,但我无法使用相同的密码登录(LeeT1337)
此外,当我导出所有用户时,运行
firebase auth:export auth-export.json --format json
与所有其他用户不同,导入的用户没有passwordHash
属性
我还尝试了先对哈希进行base64编码(因为在旧的堆栈帖子中建议使用,但在文档中不再使用)
另外,我还尝试通过cli(firebase)导入-tools@8.13.1)与:
及
但是得到了同样的结果:导入有效,登录无效
Buffer.from('5457ae6b180556bc65b423ba3a36124ec44f6cbec7da84e483daa2a46dec3f97')
需要改成
Buffer.from('5457ae6b180556bc65b423ba3a36124ec44f6cbec7da84e483daa2a46dec3f97', 'hex')
Buffer.from('5457ae6b180556bc65b423ba3a36124ec44f6cbec7da84e483daa2a46dec3f97')
Buffer.from('5457ae6b180556bc65b423ba3a36124ec44f6cbec7da84e483daa2a46dec3f97', 'hex')