0

我正在尝试通过django-allauth[社交人数]软件包,但当单击Google Sign-In按钮时,我会得到?进程=登录查询字符串附加到URL,但没有其他内容。

我遵循了官方回购尤其是此部分模板我在自己的模板中复制了部分内容:

{%加载i18n%}{%load allauth%}{%加载社交网站计数%}{%get_providers作为socialcount_providers%}{%if socialacacount_providers%}{%if不是SOCIALACCOUNT_ONLY%}{%元素hr%}{%endelement%}{%元素h2%}{%translate“或使用第三方”%}{%endelement%}{%endif%}{%include“socialaccount/snippets/provider_list.html”with process=“login”%}{%include“socialaccount/snippets/login_extra.html”%}{%endif%}

我的模板:

{%extends“base.html”%}{%load allauth socialaccount%}{%加载i18n%}{%block body_class%}bg-白色圆形-lg py-5{%endblock%}{%block内容%}<div class=“flex justify-center items-center min-h-screen”><div class=“卡w-96 bg-base-100阴影-xl”><div class=“card-body”>{%get_providers作为socialachcount_providers%}{%if社交count_providers%}{%include“socialaccount/snippets/provider_list.html”with process=“login”%}{%include“socialaccount/snippets/login_extra.html”%}{%endif%}</div></div></div>{%endblock内容%}

视图.py

从django.shortcuts导入渲染从django.http导入HttpResponseRedirect从.forms导入CustomSignupForm定义索引(请求):如果请求.method==“POST”:form=CustomSignupForm(request.POST)如果form.is_valid():return HttpResponseRedirect(“/谢谢/”)其他:form=客户签名表单()return render(请求,“enterprise.html”,{“form”:form})

授权app/urls.py

从django.urls导入路径来自。导入视图urlpatterns=[路径(“login”,views.index,name=“account_login”),路径(“register”,views.index,name=“account_signup”),路径(“login”,views.index,name=“google_login”),]

根URL.py:

来自django.contrib导入管理员从django.urls导入include,路径从django.views.generic.base导入RedirectView从django.conf导入设置从django.views将默认值导入为defaultviewsurlpatterns=[路径(“”,RedirectView.as_view(url=“register”,permanent=False)),路径(“”,include(“auth_app.urls”)),路径(“admin/”,admin.site.urls),路径(“__debug__/”,包括(“debug_toolbar.uls”)),]

设置.py:

...SOCIALACOUNT_PROVIDERS={“谷歌”:{“EMAIL_AUTHENTICATION”:正确,“范围”:[“配置文件”,“电子邮件”,],“应用程序”:{“client_id”:“xxx”,“机密”:“xxx”,},“授权参数”:{“access_type”:“在线”,},“FETCH_USERINFO”:正确,“OAUTH_PKCE_ENABLED”:正确,}}...

我认为问题可能是因为我将默认URL从domain.com/accounts/login域名/登录,更改了根urls.py,但也没有更改。

我真的不知道下一步该去哪里。欢迎提出任何想法。

0

重置为默认值

你的答案

单击“发布您的答案”,表示您同意我们的服务条款并确认您已阅读我们的隐私政策.