Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Alternative to the 120k limit on rounds for hashed password imports using auth.UserImportHash.pbkdf2_sha256

Open
#512 8 comments 7 reactions 1 assignee View on GitHub

@bojeil-google is already working on this.

Since Dec 8, 2020.

Assessment

This issue has not been assessed yet.

Description

api: auth

I'm looking to migrate users from Django to firebase, below is the code I'm using for testing. The issue I'm facing is that it seems that the passwords have been hashed using 150k rounds when the firebase docs says the maximum is 120k for SHA256: https://firebase.google.com/docs/auth/admin/import-users#python

Is there an alternative?

Here is the error I get:
ValueError: rounds must not be larger than 120000.

import firebase_admin
from firebase_admin import auth, exceptions
from passlib.utils import to_bytes


server_path = ''
fb_credentials = firebase_admin.credentials.Certificate(server_path + 'files/serviceAccount.json')
firebase_admin.initialize_app(fb_credentials)


old_hash = 'pbkdf2_sha256$150000$rsWX3Dbbd3K6$EYgXPBAz/Ero9PIgIFs/8pWGmGT+diTOQs1DZv4Ytjw='
email = 'user@gmail.com'

rounds = int(old_hash.split('$')[1])
salt = old_hash.split('$')[2]

users = [
    auth.ImportUserRecord(
        uid='70sSUptkmkN95QTFJ0gWduzdlpP1',
        email=email,
        password_hash=to_bytes(old_hash),
        password_salt=to_bytes(salt)
    ),
]

hash_alg = auth.UserImportHash.pbkdf2_sha256(rounds=rounds)
try:
    result = auth.import_users(users, hash_alg=hash_alg)
    for err in result.errors:
        print('Failed to import user:', err.reason)
except exceptions.FirebaseError as error:
    print('Error importing users:', error)
Dominant language
Python
Stars
1.2k
Forks
359
Avg merge
3d 9h
Merged PRs (30d)
3

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from firebase/firebase-admin-python

All issues in firebase/firebase-admin-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.