djangoauthenticationdjango-allauthgoogle-authenticator

Login with Google redairecting on conformation page to continue Django


I am trying to integrate Google Authentication into my login page. I am working in Django. I have added login with Google Button on my login page, but when I click on that button, I am redirecting to accounts/google/login where it's asking for conformation to continue and menu with sign-in and sign-out.

But what I want is when I click on the button it should ask for accounts to login instead.

This is my login screen: enter image description here

This is what I get on click on the button: enter image description here

this is my button login code in HTML: Login.html:

 {% if user.is_authenticated %}
        <p>Welcome, You are logged in as {{ user.username }}</p>
    {% else %}
        <a href="{% provider_login_url 'google' %}">Login With Google</a>
    {% endif %}

How can I skip this conformation page , it will be glad if anyone can help me out with this thank you.


Solution

  • This behavior was released in version 0.47.0:

    Added a new setting SOCIALACCOUNT_LOGIN_ON_GET that controls whether or not the endpoints for initiating a social login (for example, “/accounts/google/login/”) require a POST request to initiate the handshake. As requiring a POST is more secure, the default of this new setting is False.

    You can add the flag in your settings.py file to avoid the intermediate page:

    SOCIALACCOUNT_LOGIN_ON_GET=True
    

    And keep using the latest version of the library.