【发布时间】:2018-04-24 00:15:26
【问题描述】:
使用 firebase python API,我为我的应用程序的用户 ID 创建了自定义令牌,这是为了启用验证并可能从后端请求用户数据。
这是我的示例代码:
#create custom token with uid
custom_token = firebase_admin.auth.create_custom_token(uid)
print custom_token
decoded_token =
firebase_admin.auth.verify_id_token(id_token=custom_token,
check_revoked=True)
但是我在使用 Python 的 firebase 上收到以下错误:
Firebase ID token has incorrect "aud" (audience) claim. Expected "sec-vef-sandbox" but got "https://identitytoolkit.googleapis.com/google.identity.identitytoolkit.v1.IdentityToolkit". Make sure the ID token comes from the same Firebase project as the service account used to authenticate this SDK. See https://firebase.google.com/docs/auth/admin/verify-id-tokens for details on how to retrieve ID token.
我已确保 projectId 与“sec-vef-sandbox”匹配,因此看不到错误来自何处。在查看 Stack Overflow 上的其他帖子后,它似乎是一个 firebase 错误。我想知道有没有办法解决这个问题。
【问题讨论】:
标签: python firebase firebase-authentication google-oauth