admin管理员组文章数量:1434934
Firebase email confirmation is not working
I have set up email sending in Firebase Auth. The email arrives, but after clicking the generated link, the email_verified flag remains false.
Here is my code for sending the email.
email_verify_response = requests.post(
f':sendOobCode?key={FIREBASE_API_KEY}',
json={"requestType": "VERIFY_EMAIL", "idToken": id_token}
)
email_verify_data = email_verify_response.json()
if 'error' in email_verify_data:
print("Ошибка при отправке email для подтверждения")
return firebase_error_response(email_verify_data['error']['message'], 503)
print("Email для подтверждения отправлен")
Here is the code for fetching the users (I run it after clicking the link to check the flag).
users = []
page = auth.list_users()
while page:
for user in page.users:
users.append({
"uid": user.uid,
"email": user.email,
"email_verified": user.email_verified,
"display_name": user.display_name,
"photo_url": user.photo_url,
"last_sign_in_timestamp": user.tokens_valid_after_timestamp,
"created_at": user.user_metadata.creation_timestamp
})
page = page.get_next_page()
return jsonify(users), 200
What could be the problem?
Firebase email confirmation is not working
I have set up email sending in Firebase Auth. The email arrives, but after clicking the generated link, the email_verified flag remains false.
Here is my code for sending the email.
email_verify_response = requests.post(
f'https://identitytoolkit.googleapis/v1/accounts:sendOobCode?key={FIREBASE_API_KEY}',
json={"requestType": "VERIFY_EMAIL", "idToken": id_token}
)
email_verify_data = email_verify_response.json()
if 'error' in email_verify_data:
print("Ошибка при отправке email для подтверждения")
return firebase_error_response(email_verify_data['error']['message'], 503)
print("Email для подтверждения отправлен")
Here is the code for fetching the users (I run it after clicking the link to check the flag).
users = []
page = auth.list_users()
while page:
for user in page.users:
users.append({
"uid": user.uid,
"email": user.email,
"email_verified": user.email_verified,
"display_name": user.display_name,
"photo_url": user.photo_url,
"last_sign_in_timestamp": user.tokens_valid_after_timestamp,
"created_at": user.user_metadata.creation_timestamp
})
page = page.get_next_page()
return jsonify(users), 200
What could be the problem?
Share Improve this question asked Nov 17, 2024 at 12:07 MaximMaxim 274 bronze badges1 Answer
Reset to default 0Once an ID token has been minted it is immutable. So the email_verified
claim will only be updated once a new ID token is minted.
In the client-side code that gets the ID token, you can force getting a new token on the user object. If you send that token to the server, the email_verified
will then show the up-to-date value.
本文标签: pythonFirebase email confirmation is not workingStack Overflow
版权声明:本文标题:python - Firebase email confirmation is not working - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745636264a2667575.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论