FirebaseCLIを使用してアカウントを別プロジェクトにインポートしたいと思っております。
以下の通り試してみたところ、アカウントのインポートはできているようですが、パスワード情報が正常にインポートできていないようで、 ログインを試みるとエラーが返ってきます。
※コンソールから該当のアカウントのパスワードリセットをした後は正常にログインできるので、パスワードのインポートができていないのだと予想しております。
環境
プロジェクトA : アカウントを export
したいプロジェクト
プロジェクトB : アカウントを import
したいプロジェクト
CLI version
> firebase --version 3.16.0
アカウントのexport
プロジェクトAにて以下コマンド実行
> firebase auth:export accounts.json --format=json Exporting accounts to accounts.json ✔ Exported 1 account(s) successfully.
アカウントのimport
プロジェクトBにて以下コマンド実行
# プロジェクトA > Authentication > ... > パスワードハッシュパラメータ から以下の値をコピー # --hash-key : base64_signer_keyの値 # --salt-separator : base64_salt_separatorの値 # --rounds : roundsの値 # --mem-cost : mem_costの値 > firebase auth:import ../proj_a/accounts.json \ --hash-algo="SCRYPT" \ --hash-key="xxx" \ --salt-separator="xxx" \ --rounds=8 \ --mem-cost=8 Processing ../proj_a/accounts.json (356 bytes) Starting importing 1 account(s). ✔ Imported successfully.
結果
プロジェクトBのコンソール上では、importしたアカウントが表示されております。
プロジェクトBの環境で以下jsを実行するとエラーが返ってきます。
firebase.auth().signInWithEmailAndPassword(mail, pass)
エラー内容
POST https://www.googleapis.com/identitytoolkit/v3/relyingparty/verifyPassword?key=xxx 400 () code: "auth/wrong-password", message: "The password is invalid or the user does not have a password."
ご存知のかたよろしくお願いします。
===================================================
今回検証にて実際に使用した情報は以下の通りです。
エクスポート
- エクスポートしたアカウント
メール : test@hoge.com
パスワード : 11111111
- コマンド
firebase auth:export accounts.json --format=json
- accounts.json
{"users": [ { "localId": "NLO5F7QCgZZFjtOrsGEpOT6G3YB3", "email": "test@hoge.com", "emailVerified": false, "passwordHash": "8uxwur+eZuT2GnGx/cEcVq3abOewcvtP+XKB4eeZbHaazGLan1Em0gFXAgvzWN4/t/43pejYr41A39MkcfKTdQ==", "salt": "nj0vBi53udCVeQ==", "createdAt": "1514618866000", "providerUserInfo": [] }]}
- パスワードハッシュパラメータ
hash_config { algorithm: SCRYPT, base64_signer_key: PmoPS+RjzExJmFS8rlArNjhKLPctwy2P8IvNwTGOtA1w7MeI2d0NutqhYHx/BSnuKKJ3tZjjjN7HrGi0qjMvKA==, base64_salt_separator: Bw==, rounds: 8, mem_cost: 14, }
インポート
- コマンド
firebase auth:import ./accounts.json \ --hash-algo="SCRYPT" \ --hash-key="PmoPS+RjzExJmFS8rlArNjhKLPctwy2P8IvNwTGOtA1w7MeI2d0NutqhYHx/BSnuKKJ3tZjjjN7HrGi0qjMvKA==" \ --salt-separator="Bw==" \ --rounds=8 \ --mem-cost=8
- インポートしたアカウントを更にエクスポートした結果
パスワード関連の値が含まれていませんでした。
{ "localId": "NLO5F7QCgZZFjtOrsGEpOT6G3YB3", "email": "test@hoge.com", "emailVerified": false, "createdAt": "1514618866000", "providerUserInfo": [] },
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/12/30 07:43
2017/12/30 10:05 編集
2017/12/30 10:08
2017/12/30 13:01 編集
2017/12/30 13:03
2017/12/30 13:09 編集
2017/12/30 15:40
2017/12/30 22:51 編集
2017/12/31 01:20