首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >python-social-auth,注销而不断开连接

python-social-auth,注销而不断开连接
EN

Stack Overflow用户
提问于 2015-03-29 16:12:53
回答 1查看 706关注 0票数 3

在注销时,删除社交登录的访问令牌不是很自然吗?(用户下次登录时可以使用不同的社交账号登录)

如何使用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问了同样的问题,但答案实际上并没有解决他的问题。

EN

回答 1

Stack Overflow用户

发布于 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注销,

代码语言:javascript
复制
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)
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29326997

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档