Skip to content

Update snippet for importing users with Firebase scrypt hashed passwords #479

Closed

Description

@thomasmburke

Describe the problem

When trying to migrate users across tenants in a test app I noticed that the PasswordHash of users I moved to the new tenant was being changed to the previous tenant's PasswordHash base64 encoded again. This means when a user tries to sign in with this newly imported user the correct password will be invalid

Additionally, when exporting users I noticed that some of the users' PasswordHash had - and _ characters in it, so the previous function for decoding (base64.StdEncoding.DecodeString()) would throw an error when it encountered the byte containing that character. Instead we need to use base64 URL encoding to decode, so we need a function that does just that (base64.URLEncoding.DecodeString(s)).

The hash key on the other hand can have a / character in it so it still requires Standard base64 encoding

In short: the user's PasswordHash uses a different flavor of base 64 encoding then the signer key provided in the Firebase/Cloud Console and needs to be decoded properly before uploading a user.

Activity

  1. google-oss-bot commented on Jan 14, 2022

    @google-oss-bot
    Collaborator

    I found a few problems with this issue:

    • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
    • This issue does not seem to follow the issue template. Make sure you provide all the required information.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions