Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

password_hash obtained from Firebase Auth backend needs to be base64URL decoded before import to avoid double encoding #652

Merged
merged 1 commit into from
Oct 14, 2022

Conversation

thomasmburke
Copy link
Contributor

@thomasmburke thomasmburke commented Oct 12, 2022

This is implementing the same change as firebase/firebase-admin-go#480 just on this python Admin SDK.

When developers export users from Firebase Auth's backend they arrive with an encoded password hash and salt. This change decodes the password hash and salt, so that it isn't double encoded upon importing these users back to Firebase.

We don't need to change other python samples (e.g. HMAC) that provide password hash and salt as they are being migrated from other auth systems that use other hashing algorithms. It is fair to assume (we won't know) that the password hash and salt from those other backends has been decoded properly.

Tests:

  • If you export a user and use the import code as it is written in the public docs it will successfully import the user, but you will be unable to sign in because of the double encoding effectively changing the password
  • With this decoding you can successfully import a user and sign in after now that the double encoding is removed.

…RL decoded before import to avoid double encoding
Copy link
Member

@lahirumaramba lahirumaramba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @thomasmburke !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants