【问题标题】:getting local user token for a social account user获取社交帐户用户的本地用户令牌
【发布时间】:2015-09-29 20:24:16
【问题描述】:

我正在使用 django-oauth-toolkit 作为我自己的 oauth2 提供者。 allauth 用于所有身份验证。最重要的是rest-auth,它为两者提供了rest接口。

我的用户可以选择通过其他社交帐户提供商(例如 facebook 等)登录/注册

我通过 Facebook 的 /rest-auth/facebook/ POST containing the authentication token 注册用户(让我们继续举例)。

作为回报,我得到了一些不是我需要的 oauth2 令牌的令牌。 如何获取我的 oauth2 令牌?

【问题讨论】:

  • 你能展示你的代码吗?

标签: django oauth-2.0 django-rest-framework django-allauth django-rest-auth


【解决方案1】:

我找到了解决方案。 追踪 rest-auth 和 allauth 比我想象的要难,直到我找到这个解决方案:

基本上,我将 django oauth 工具包中的 TemplateView 与 rest-auth 中的 LoginView 合并。然后我创建一个 BearerToken 并返回它,而不是存储 rest-framework Authentication Token

Github-Commit of the solution

【讨论】:

    猜你喜欢
    • 2014-08-20
    • 1970-01-01
    • 2017-12-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-29
    • 1970-01-01
    • 2013-04-06
    相关资源
    最近更新 更多