在注销时,删除社交登录的访问令牌不是很自然吗?(用户下次登录时可以使用不同的社交账号登录)
如何使用python-social-auth完成此操作?
https://python-social-auth.readthedocs.org/en/latest/pipeline.html#disconnection-pipeline谈到了disconnecting,我猜它更接近closing the account而不是logout
Logout with django-social-auth问了同样的问题,但答案实际上并没有解决他的问题。
发布于 2018-05-18 17:38:16
只需使用默认的django注销,即使是登录,如果您看到里面的代码,它将询问来自OP的数据并从该数据创建adjango login。并将所有信息存储在socialauth用户中。python-social-auth还为社交身份验证用户提供了类,并在后端存储了许多内容,因此您可以查看social_django中的models.py和storage.py以供参考。
在我当前使用django和python-social-auth的social-auth-app-django的项目中,我使用的是默认的django注销,
from django.contrib.auth import logout as auth_logout
class logout(TemplateView):
next_page = settings.LOGOUT_REDIRECT_URL
redirect_field_name = REDIRECT_FIELD_NAME
template_name = None
extra_context = None
@method_decorator(never_cache)
def dispatch(self, request, *args, **kwargs):
auth_logout(request)
next_page = settings.LOGOUT_REDIRECT_URL
if next_page:
return HttpResponseRedirect(next_page)
return super().dispatch(request, *args, **kwargs)https://stackoverflow.com/questions/29326997
复制相似问题