[英]My configuration of firebase_admin is good to authenticate users?
I want to verify the token id my code its working, but why is working?我想验证我的代码的令牌 id 是否有效,但为什么有效? i setup good?我设置好了吗?
i have that doubt because auth variable does not know the credentials to verify the token, the variable who know the credentials is firebase_app
, how auth variable is verifying the token?我有这个疑问,因为 auth 变量不知道验证令牌的凭据,知道凭据的变量是firebase_app
,auth 变量如何验证令牌?
from firebase_admin import auth
from django.conf import settings
firebase_creds = credentials.Certificate(FIREBASE_CONFIG_credentials)
firebase_app = firebase_admin.initialize_app(firebase_creds)
def login(request):
token = 'eyJhbGciO...'
try:
decoded_token = auth.verify_id_token(token)
Auth comes from firebase_admin:身份验证来自 firebase_admin:
from firebase_admin import auth
When you initialize firebase_admin:初始化 firebase_admin 时:
firebase_app = firebase_admin.initialize_app(firebase_creds)
you are also initializing all of its components.你也在初始化它的所有组件。
If your calls are not returning any errors, then everything is OK.如果您的调用没有返回任何错误,那么一切正常。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.