Unable to import user account using CLI command Firebase auth: import

I need to import a list of users with email and password into Firebase.

I am trying to import users into Firebase using the auth: import CLI command. ( https://firebase.google.com/docs/cli/auth-import )

I chose hash-algo HMAC_MD5 ,

I use helpmeplease as a secret line for encritption -> in Base64 becames aGVscG1lcGxlYXNl

I use mypass as a test password: crypted with HMAC_MD5 and secret "helpmeplease" IT becames 3a52377f6635d298436013953a1ce4dd and becames Bas64 M2E1MjM3N2Y2NjM1ZDI5ODQzNjAxMzk1M2ExY2U0ZGQ =

I am using user.json

  {    "users": [ 

    { 

      "localId": "9997", 

      "email": "test@test.com", 

      "passwordHash": "M2E1MjM3N2Y2NjM1ZDI5ODQzNjAxMzk1M2ExY2U0ZGQ=", 

      "displayName": "9997", 

    }

  ]  }

I use the command:

**firebase auth:import --hash-algo='HMAC_MD5' --hash-key='aGVscG1lcGxlYXNl' --project='my-project-name-test' users.json** 

and the result:

Processing users.json (194 bytes)

Start import of 1 account.

Imported successfully .

and the user is imported into the user database.

BUT .. when I try to login using auth (). signInWithEmailAndPassword (' test@test.com ', 'mypass') . I get this error:

{[Error: the password is incorrect or the user does not have a password.] Code: 'auth / wrong-password',

: ' .' }

, ... ?

+4
2

, . , HMAC_MD5?

NodeJS - HMAC_MD5.

var crypto = require('crypto');
crypto.createHmac('md5', 'helpmeplease').update('mypass').digest().toString('base64');

"OlI3f2Y10phDYBOVOhzk3Q ==". Firebase Auth. , .

+6

@wyhao31

PHP , , Firebase.

hash_hmac() PHP:

$secret = "helpmeplease";  
$password = "mypass";  
$hmac_md5 = hash_hmac('md5', $password, $secret);  //3a52377f6635d298436013953a1ce4dd
$base64 = base64_encode($hmac_md5); //M2E1MjM3N2Y2NjM1ZDI5ODQzNjAxMzk1M2ExY2U0ZGQ=

, hmac_md5:

$secret = "helpmeplease";  
$password = "mypass";  
$base64 = base64_encode(hash_hmac('md5', $password, $secret, TRUE));  //OlI3f2Y10phDYBOVOhzk3Q==

, , !

!

+1

Source: https://habr.com/ru/post/1661905/


All Articles