Django Allauth Google Sign-In not working

I am trying to get a custom form to work with Google via the django-allauth[socialaccount] package but when clicking on the Google Sign-In button, I am getting the ?process=login query string appended to the URL, but nothing else.

I have followed the examples available in the official repo and in particular this partial template that I copied in part in my own template:

{% load i18n %}
{% load allauth %}
{% load socialaccount %}
{% get_providers as socialaccount_providers %}
{% if socialaccount_providers %}
    {% if not SOCIALACCOUNT_ONLY %}
        {% element hr %}
        {% endelement %}
        {% element h2 %}
            {% translate "Or use a third-party" %}
        {% endelement %}
    {% endif %}
    {% include "socialaccount/snippets/provider_list.html" with process="login" %}
    {% include "socialaccount/snippets/login_extra.html" %}
{% endif %}

My template:

{% extends "base.html" %}
{% load allauth socialaccount %}
{% load i18n %}

{% block body_class %}bg-white rounded-lg py-5{% endblock %}

{% block content %} 

  <div class="flex justify-center items-center min-h-screen">
      <div class="card w-96 bg-base-100 shadow-xl">
          <div class="card-body">
            {% get_providers as socialaccount_providers %}
                {% if socialaccount_providers %}
                    {% include "socialaccount/snippets/provider_list.html" with process="login" %}
                    {% include "socialaccount/snippets/login_extra.html" %}
            
                {% endif %}
        </div>
    </div>
</div>
{% endblock content %}

views.py

from django.shortcuts import render
from django.http import HttpResponseRedirect

from .forms import CustomSignupForm


def index(request):
    if request.method == "POST":
        form = CustomSignupForm(request.POST)
        if form.is_valid():
            return HttpResponseRedirect("/thanks/")

    else:
        form = CustomSignupForm()
    return render(request, "entrance.html", {"form": form})

auth_app/urls.py

from django.urls import path

from . import views

urlpatterns = [
    path("login", views.index, name="account_login"),
    path("register", views.index, name="account_signup"),
    path("login", views.index, name="google_login"),
]

root urls.py:

from django.contrib import admin
from django.urls import include, path
from django.views.generic.base import RedirectView
from django.conf import settings
from django.views import defaults as default_views

urlpatterns = [
    path("", RedirectView.as_view(url="register", permanent=False)),
    path("", include("auth_app.urls")),
    path("admin/", admin.site.urls),
    path("__debug__/", include("debug_toolbar.urls")),
]

settings.py:

...
SOCIALACCOUNT_PROVIDERS = {
    "google": {
        "EMAIL_AUTHENTICATION": True,
        "SCOPE": [
            "profile",
            "email",
        ],
        "APP": {
            "client_id": "xxx",
            "secret": "xxx",
        },
        "AUTH_PARAMS": {
            "access_type": "online",
        },
        "FETCH_USERINFO": True,
        "OAUTH_PKCE_ENABLED": True,
    }
}
...

I thought that the issue could come from the fact that I changed the default URLs from domain.com/accounts/login to domain.com/login, changed the root urls.py but no changes there either.

I don't really know where to look next. Any idea would be welcome.

Back to Top