Alternative to the 120k limit on rounds for hashed password imports using auth.UserImportHash.pbkdf2_sha256
@bojeil-google arbeitet bereits daran.
Seit 08.12.2020.
Bewertung
Dieses Issue wurde noch nicht bewertet.
Beschreibung
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)
- Vorherrschende Sprache
- Python
- Sterne
- 1.2k
- Forks
- 359
- Ø Merge
- 3 T. 9 Std.
- Gemergte PRs (30 T.)
- 3
Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus firebase/firebase-admin-python
-
api: remoteconfig
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
firebase/firebase-admin-python#957 · 1 Kommentar ·
-
api: database type: feature request
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 45/100
firebase/firebase-admin-python#978 · 1 Kommentar ·
-
[FR] Support VERIFY_AND_CHANGE_EMAIL in generate_email_action_link (parity with firebase-admin-node) Offenapi: auth
firebase/firebase-admin-python#949 · 2 Kommentare · 1 Reaktion · 1 zugewiesene Person ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 43/100
firebase/firebase-admin-python#945 · 1 Kommentar · 1 Reaktion ·
Alle Issues in firebase/firebase-admin-python
Ähnliche Issues
-
essnmx good first issue
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 95/100
-
[Feature] 奇物选择添加优先级 Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
syfoud/Simulated_Scepter#174 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
Giskard-AI/giskard-oss#2840 · 1 Kommentar ·
-
A claim comment carrying the issue number is silently declined while the workflow reports success Offenarea: repo bug perceived difficulty: 2
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
yeti-platform/yeti#1380 ·