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

Update passwordHash and passwordSalt to be base64 decoded before user import #775

Merged
merged 1 commit into from
Feb 28, 2023

Conversation

NhienLam
Copy link
Contributor

Issue: Using the importWithScrypt() code snippet in the public doc will successfully import the user, but we will be unable to sign in because the password is changed.

This may be similar to this issue in Firebase Admin Go: https://github.com/firebase/firebase-admin-go/issues/479 and the fixes in https://github.com/firebase/firebase-admin-go/pull/480 and https://github.com/firebase/firebase-admin-python/pull/652

After this change, we can successfully import a user and sign in with the original password.

Note: I use BaseEncoding.base64() instead of BaseEncoding.base64Url() because BaseEncoding.base64Url().decode will throw an Unrecognized character: + exception if the password hash contains '+'.

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 @NhienLam ! LGTM!

Do you think we should update other import snippets, too? importWithBcrypt etc.

@NhienLam
Copy link
Contributor Author

Do you think we should update other import snippets, too? importWithBcrypt etc.

Thanks @lahirumaramba! I think the other import snippets don't need to be changed because they are using other hashing algorithms. Quote from firebase/firebase-admin-python#652: "It is fair to assume that the password hash and salt from those other backends has been decoded properly."

@NhienLam NhienLam merged commit 95e5427 into master Feb 28, 2023
@NhienLam NhienLam deleted the nhienlam-auth-snippet branch February 28, 2023 18:25
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.

2 participants