-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
30 lines (26 loc) · 937 Bytes
/
Copy pathtest.py
File metadata and controls
30 lines (26 loc) · 937 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import os
from firebase import Firebase
import jwt
from dotenv import load_dotenv
load_dotenv()
config = {
"apiKey": os.environ.get("FIREBASE_APIKEY"),
"authDomain": os.environ.get("FIREBASE_AUTHDOMAIN"),
"databaseURL": os.environ.get("FIREBASE_DATABASEURL"),
"projectId": os.environ.get("FIREBASE_PROJECT_ID"),
"storageBucket": os.environ.get("FIREBASE_STORAGE_BUCKET"),
"messagingSenderId": os.environ.get("FIREBASE_MESSAGING_SENDER_ID"),
"appId": os.environ.get("FIREBASE_APP_ID"),
"measurementId": os.environ.get("FIREBASE_MEASUREMENT_ID")
}
firebase = Firebase(config)
auth = firebase.auth()
# Login user
user = auth.sign_in_with_email_and_password("test@gmail.com", "123456")
token = user['idToken']
# Decode token (optional)
payload = jwt.decode(token, options={"verify_signature": False})
print(payload["email"])
# Check verified
info = auth.get_account_info(token)
print(info["users"][0]["emailVerified"])