Metadata-Version: 2.4
Name: django_gauth
Version: 0.2.2
Summary: A Django app for providing the Google's discovery based Oauth2 authentication mechanism is HTTP/HTTPS oriented Django Servers/Projects.
Author-email: Ankit Kumar <ankit.kumar05@telusdigital.com>, Ankit Yadav <ankit8290@gmail.com>
Maintainer-email: Ankit yadav <ankit8290@gmail.com>
License: MIT License
        
        Copyright (c) 2025 Ankit Yadav
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Documentation, https://masterpiece93.github.io/django-gauth/
Project-URL: Source, https://github.com/masterPiece93/django-gauth
Project-URL: Issues, https://github.com/masterPiece93/django-gauth/issues
Project-URL: Changelog, https://github.com/masterPiece93/django-gauth/blob/main/CHANGELOG.md
Keywords: django_gauth,google,oauth2,auth
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Framework :: Django :: 3.1
Classifier: Framework :: Django :: 3.2
Classifier: Framework :: Django :: 4.0
Classifier: Framework :: Django :: 4.1
Classifier: Framework :: Django :: 4.2
Classifier: Framework :: Django :: 5.0
Classifier: Framework :: Django :: 5.1
Classifier: Framework :: Django :: 5.2
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Classifier: Topic :: Internet :: WWW/HTTP :: Session
Classifier: Topic :: Security
Classifier: Topic :: Utilities
Classifier: Typing :: Typed
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: google-auth-oauthlib<1.3.0,>=1.0.0
Requires-Dist: Django>=3.1; python_version >= "3.9" and python_version < "3.11"
Requires-Dist: Django>=4.2.26; python_version >= "3.9"
Dynamic: license-file

# Google Auth <sup>[ Django ]</sup>

[![PyPI version](https://img.shields.io/pypi/v/django-gauth?label=PyPI&color=blue)](https://pypi.org/project/django-gauth/)
[![Python versions](https://img.shields.io/pypi/pyversions/django-gauth)](https://pypi.org/project/django-gauth/)
[![Django versions](https://img.shields.io/pypi/frameworkversions/django/django-gauth?label=Django&color=0C4B33)](https://pypi.org/project/django-gauth/)
[![Downloads](https://img.shields.io/pypi/dm/django-gauth?label=downloads&color=brightgreen)](https://pypi.org/project/django-gauth/)
[![License](https://img.shields.io/pypi/l/django-gauth?color=green)](https://github.com/masterPiece93/django-gauth/blob/main/LICENSE)
[![Documentation](https://img.shields.io/badge/docs-online-blue)](https://masterpiece93.github.io/django-gauth/)
[![tests](https://github.com/masterPiece93/django-gauth/actions/workflows/tests.yml/badge.svg)](https://github.com/masterPiece93/django-gauth/actions/workflows/tests.yml)
[![coverage](https://raw.githubusercontent.com/masterPiece93/django-gauth/badges/coverage.svg)](https://github.com/masterPiece93/django-gauth/actions/workflows/tests.yml)
[![pages-build-deployment](https://github.com/masterPiece93/django-gauth/actions/workflows/pages/pages-build-deployment/badge.svg)](https://github.com/masterPiece93/django-gauth/actions/workflows/pages/pages-build-deployment)
[![Pylint](https://github.com/masterPiece93/django-gauth/actions/workflows/pylint.yml/badge.svg)](https://github.com/masterPiece93/django-gauth/actions/workflows/pylint.yml)

> [Official Documentation](https://masterpiece93.github.io/django-gauth/)

## Why django-gauth?

> **Google sign-in for Django in 5 minutes — without the django-allauth configuration maze.**

`django-gauth` does exactly one thing well: add **Google OAuth2 login** to an HTTP/HTTPS Django
project, with a working landing page included — no multi-provider abstractions, no sprawling
configuration, just the Google flow, clearly documented.

| | **django-gauth** | **django-allauth** | **Roll-your-own** |
| --- | :---: | :---: | :---: |
| Setup for *just Google* | ⚡ Minimal (3 settings + 1 URL include) | 🧩 Broad, multi-step config | 🛠️ Manual OAuth wiring |
| Built-in login page | ✅ Ships a landing page | ➖ Bring your own templates | ❌ Build it yourself |
| Scope | 🎯 Google OAuth2 only | 🌐 Many providers | 🎯 Whatever you build |
| Learning curve | 📉 Low | 📈 Higher (large surface) | ⚠️ Easy to get OAuth subtly wrong |
| Typed & tested | ✅ Type hints + ~99% coverage | ✅ Mature | ➖ Up to you |

**Reach for `django-allauth`** when you need many providers, account linking, and email
workflows. **Reach for `django-gauth`** when you want Google sign-in working *today* with
minimal ceremony.

## Installation

<!-- Implement Carousal -->

| 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 )    
    ```python
    # 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 )
    ```python
    # 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 !!

---

## Changelog

See [`CHANGELOG.md`](https://github.com/masterPiece93/django-gauth/blob/main/CHANGELOG.md) for the full release history and notable changes in each version.

<br>

## Releases

See [`Github Releases`](https://github.com/masterPiece93/django-gauth/releases) for the details of each release in each version .

<br>

