Skip to main content

A Django app for providing the Google's discovery based Oauth2 authentication mechanism is HTTP/HTTPS oriented Django Servers/Projects.

Project description

Google Auth [ Django ]

Static Badge pages-build-deployment Pylint

Official Documentation

Installation

Source Command
GitHub pip install -e git+https://github.com/masterPiece93/django-gauth.git#egg=django_gauth
PyPi pip install django-gauth

Quickstart

  1. add the app name : django_gauth in INSTALLED_APPS entry of you project ( in settings.py file )

  2. add required configuration variables ( in settings.py file )

    # settings.py
    GOOGLE_CLIENT_ID= env("GOOGLE_CLIENT_ID")           # << set according to your oauth2 client
    GOOGLE_CLIENT_SECRET= env("GOOGLE_CLIENT_SECRET")   # << set according to your oauth2 client
    GOOGLE_AUTH_FINAL_REDIRECT_URL= None        # defaults to `<host>/gauth/`
    CREDENTIALS_SESSION_KEY_NAME= "credentials" # defaults to `credentials`
    STATE_KEY_NAME= "oauth_state"               # defaults to `oauth_state`
    SCOPE= [
        "https://www.googleapis.com/auth/userinfo.email"    # always preffered
        ,"https://www.googleapis.com/auth/userinfo.profile" # always preffered
        ,"openid"                                           # always preffered
        ,"https://www.googleapis.com/auth/drive"            # based on your usage
    ]
    os.environ['OAUTHLIB_INSECURE_TRANSPORT'] = '1'         # strictly for local-development only
    
    • os.environ['OAUTHLIB_INSECURE_TRANSPORT'] = '1' directs the server to accept in-secure (http) connections .
  3. configure auth urls ( in urls.py file of root )

    # urls.py
    from django.contrib import admin
    from django.urls import path, include
    
    urlpatterns = [
        path('admin/', admin.site.urls),
        path('gauth/', include('django_gauth.urls')),
        
        # add your other app's urls
        # ...
    
    ]
    
  4. now run your project server

    • once your server is up & running , navigate to .../gauth, this is the master interface ( default landing page )
    • click on Authenticate button to launch Google Oauth2 Login .
    • just follow the flow you are directed to .
    • post authentication , you'll be redirected back to .../gauth
  • NOTE : useually all servers ( wsgi, asgi, uWsgi) runs default on http://127.0.0.1:PORT/ , hence always take care to set the redirect endpoints in your google oauth2 client app in accordance with 127.0.0.1 , don't mistake to consider localhost , 0.0.0.0 and 127.0.0.1 as the same thing while dealing with redirect uri's .
    • For example : suppose you have set http://localhost:PORT/gauth/google-callback as your redirect uri , then take note of running your django app on localhost:PORT only !!


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_gauth-0.2.1.tar.gz (58.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_gauth-0.2.1-py3-none-any.whl (46.3 kB view details)

Uploaded Python 3

File details

Details for the file django_gauth-0.2.1.tar.gz.

File metadata

  • Download URL: django_gauth-0.2.1.tar.gz
  • Upload date:
  • Size: 58.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for django_gauth-0.2.1.tar.gz
Algorithm Hash digest
SHA256 69a6e2ab04146dfbf8aa46f82463cba2d4753a6a683dfa493e994a61f6cb4ef9
MD5 29d437497048872d3817e2fcd203355c
BLAKE2b-256 1f4a4f2dfd164041ed6fed66ece3b80c309eefbc68a665ad97893387511e5cf2

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_gauth-0.2.1.tar.gz:

Publisher: release.yml on masterPiece93/django-gauth

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_gauth-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: django_gauth-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 46.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for django_gauth-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0b41bb3f713b8765d40a8155caeea406dbc0d77f62f5ea4c2416d567cc113734
MD5 7f67fb59bf2c73b4df363148faaa1a16
BLAKE2b-256 946bddd1a061acdd6e017455d9695c2b0c6d3ae4bee39d7bae440751c806c9d7

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_gauth-0.2.1-py3-none-any.whl:

Publisher: release.yml on masterPiece93/django-gauth

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page