我正在尝试通过将 Firebase 导出数据转换为 auth0 批量用户导入格式,将 Firebase 转换为 auth0 数据库。
我在 firebase (在 firebase_export 下)部分有一个用户,以及 firebase 哈希配置本身(下面的哈希配置), 但我不清楚 base64_signer_key 如何适合或导出中使用的盐。
{
"firebase_export": {
"localId": "localId",
"email": "[email protected]",
"emailVerified": true,
"passwordHash": "base64hash",
"salt": "user_salt",
"lastSignedInAt": "1649680364736",
"createdAt": "1649680237223",
"disabled": false,
"providerUserInfo": []
},
"hash_config": {
"algorithm": "SCRYPT",
"base64_signer_key": "base64_signer_key",
"base64_salt_separator": "base64_salt_separator",
"rounds": 8,
"mem_cost": 14
}
}
我认为架构应该是这样的,但这不起作用。 (我使用已知密码登录 auth0,但在传入 firebase 时失败)。
[
{
"user_id": $localId,
"email": $email,
"email_verified": $emailVerified,
"custom_password_hash": {
"algorithm": "scrypt",
"hash": {
"value": $passwordHash,
"encoding": "base64"
},
"salt" : {
"value": base64Decode($salt) + base64Decode($hash_config.base64_salt_separator),
// based off reading https://github.com/firebase/scrypt
"encoding":"utf8",
"position" "suffix", // based off reading https://github.com/firebase/scrypt, uses PBKDF2_SHA256 which places salt as suffix.
},
"password" : {
"encoding":"utf8"
},
"keylen": 64,
"cost": 2**$hash_config.mem_cost,
"blockSize": $hash_config.rounds,
"parallelization": 1,
},
"blocked": $disabled
}
]
由于 Firebase 使用自定义 scrypt 而不是标准实现,因此 auth0 表示“无法”导入用户。 尝试其他解决方案:
在代码中添加登录回调,以异步方式在 auth0 中创建/更新/删除用户,以缓慢迁移用户。