0

I've followed the steps to import a user from a Firebase project into one of its tenants, and the process seems to complete OK (no errors), but when I attempt to login with the email/password into the tenant, I get an invalid-password error. I'm supplying the password-hash + salt during the import along with the SCRYPT config-data, but the error remains.

Here is the core import-related code from my Java application:

List<ImportUserRecord> users = new ArrayList<>();
users.add(ImportUserRecord.builder()
    .setUid(clientUser.getUid())
    .setEmail(clientUser.getEmail())
    .setPasswordHash(clientUser.getPasswordHash().getBytes())
    .setPasswordSalt(clientUser.getPasswordSalt().getBytes())
    .build());
UserImportOptions options = UserImportOptions.withHash(
    Scrypt.builder()
        .setKey(BaseEncoding.base64().decode("zHHl...5pA==")) // key redacted
        .setSaltSeparator(BaseEncoding.base64().decode("Bw=="))
        .setRounds(8)
        .setMemoryCost(14)
        .build());
TenantAwareFirebaseAuth tenantAuth = FirebaseAuth.getInstance().getTenantManager()
    .getAuthForTenant(tenantId);
UserImportResult result = tenantAuth.importUsers(users, options);
for (ErrorInfo indexedError : result.getErrors()) {
    System.out.println("Failed to import user: " + indexedError.getReason());
}

Can anyone spot what I'm doing wrong here?

Note: I've browsed through various related questions here on Stack Overflow but none of them gives a concrete answer for solving this issue.

MLH
  • 21
  • 4

0 Answers0