[英]signout from firebase using python
Iam using django webapp.I signed in with我正在使用 django webapp.I 登录
import pyrebase
firebase = pyrebase.initialize_app(config)
authe = firebase.auth()
user = authe.sign_in_with_email_and_password(email,password)
How can I signout in similar way.我怎样才能以类似的方式注销。
The best way to to logout is to use django session, with the help of below function you can destroy token id on logout:注销的最佳方法是使用 django session,借助以下 function,您可以在注销时销毁令牌 ID:
def logout(request):
try:
del request.session['token_id']
except KeyError:
pass
return HttpResponse("You're logged out.")
For complete details, refer to the django session documentation at:有关完整的详细信息,请参阅 django session 文档,网址为:
https://docs.djangoproject.com/en/2.2/topics/http/sessions/ https://docs.djangoproject.com/en/2.2/topics/http/sessions/
This should work....这应该工作....
firebase = pyrebase.initialize_app(firebaseConfig)
auth = firebase.auth()
You should use firebase-admin, avoid work arounds like this.你应该使用 firebase-admin,避免这样的变通。
auth.current_user = None
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.