【发布时间】:2019-06-26 01:08:52
【问题描述】:
我正在通过 API 使用 django-rest-auth 进行社交身份验证。
我已经配置了 Facebook,它运行良好,但我在 Google 社交身份验证方面遇到了一些问题。
- 我已经添加到
INSTALLED_APPS:
allauth.socialaccount.providers.google',
- 创建的视图:
from allauth.socialaccount.providers.google.views import GoogleOAuth2Adapter
from allauth.socialaccount.providers.oauth2.client import OAuth2Client
class CustomGoogleOAuth2Adapter(GoogleOAuth2Adapter):
basic_auth = False
class GoogleLogin(SocialLoginView):
adapter_class = CustomGoogleOAuth2Adapter
client_class = OAuth2Client
- 由管理面板创建的应用程序
- 我收到了来自https://developers.google.com/oauthplayground/ 的
access_token - 当我尝试通过端点登录时出现错误:
Reverse for 'redirect' not found. 'redirect' is not a valid view function or pattern name.
【问题讨论】:
-
这是您的
views.py文件的全部内容吗? -
检查这是否对您有任何帮助stackoverflow.com/a/48182227/2560466
-
@Ernst 分享你的根
urls.py -
我也是用access_token,没有设置回调url。
标签: django django-allauth django-rest-auth