django allauth重定向问题调试

时间:2018-08-21 07:12:24

标签: django google-oauth django-allauth

使用django-allauth时遇到一些问题。我在django-allauth的帮助下使用Google身份验证。我已经按照官方文档中的说明在google api控制台中设置了重定向网址。此外,我还按照文档中的说明设置了LOGIN_REDIRECT_URL。

在Google api控制台中授权的重定向网址:

http://127.0.0.1:8000/accounts/google/login/callback/

Settings.py

LOGIN_REDIRECT_URL = "user_dashboard"
SOCIALACCOUNT_PROVIDERS = {
    'google': {
        'SCOPE': [
            'profile',
            'email',
        ],
    'AUTH_PARAMS': {
        'access_type': 'online',
        'hd': 'xxx.yyy'
        }
    }
}

urls.py

url('^', include('django.contrib.auth.urls')),
url(r"accounts/profile/logout", views.my_logout, name="logout"),
url(r'^accounts/',include("allauth.urls")),
url(r'^admin/', admin.site.urls),
url(r'^admin/inventory_management_app/device/router_specifications/', views.pdf_download, name = "pdfdownload"),
url(r'^admin/inventory_management_app/repair/repair_invoice/', views.repair_pdf_download, name = "pdfdownload"),
url(r'accounts/profile/home',views.my_dashboard,name='user_dashboard'),
url(r'accounts/profile/user_dashboard', views.my_dashboard, name = "user_dashboard"),

我的社交网络身份验证失败。我覆盖了authentication_error.html来找到原因,但是仍然没有得到任何可行的响应。 尽早寻求帮助。

0 个答案:

没有答案