从 firebase 迁移到 auth0

问题描述 投票:0回答:1

我正在尝试通过将 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-authentication migration auth0
1个回答
0
投票

由于 Firebase 使用自定义 scrypt 而不是标准实现,因此 auth0 表示“无法”导入用户。 尝试其他解决方案:

在代码中添加登录回调,以异步方式在 auth0 中创建/更新/删除用户,以缓慢迁移用户。
  • 向 auth0 支付大量资金来运行自定义数据库迁移(仍然很慢)。
  • 迁移所有没有密码的用户,并表示我们需要所有用户重置密码
  • 所有这些听起来都不太理想

© www.soinside.com 2019 - 2024. All rights reserved.