Django-allauth! (Google)

 Official Documentation-----> https://django-allauth.readthedocs.io/en/latest/installation.html


Python package:

pip install django-allauth

settings.py

INSTALLED_APPS = [

    'django.contrib.sites',
]



TEMPLATES = [
    {
        'BACKEND''django.template.backends.django.DjangoTemplates',
        'DIRS': [],
        'APP_DIRS'True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
                'django.template.context_processors.request',
            ],
        },
    },
]



AUTHENTICATION_BACKENDS = [
    'django.contrib.auth.backends.ModelBackend',
    'allauth.account.auth_backends.AuthenticationBackend',
]



INSTALLED_APPS = [


    'allauth',
    'allauth.account',
    'allauth.socialaccount',
]



INSTALLED_APPS = [


    'allauth.socialaccount.providers.google',   # For Google
    'allauth.socialaccount.providers.github',   # For Github
    'allauth.socialaccount.providers.facebook', # For Facbook
]



# http://localhost:8000/

ALLOWED_HOSTS = ['localhost']


SITE_ID = 1

urls.py:

from django.urls import path, include

urlpatterns = [


    path('accounts/', include('allauth.urls')),
]


Run Commend:
python manage.py migrate
python manage.py createsuperuser





For Google:
Official Documentation:https://django-allauth.readthedocs.io/en/latest/providers.html#


Google Developer Console
https://console.developers.google.com/













Go to Admin panal
















Comments