Skip to main content

django-gmail-oauth-backend

Simplifies Gmail authentication for Django applications using OAuth 2.0. WITHOUT App Passwords!

Installation

pip install django-gmail-oauth-backend

Add settings to your Django project settings file.

GMAIL_OAUTH_CLIENT_ID = 'YOUR_CLIENT_ID'
GMAIL_OAUTH_CLIENT_SECRET = 'YOUR_CLIENT_SECRET'

INSTALLED_APPS = [
    ...,
    'gmail_oauth_backend',
    ...
]

And execute the following command at least once initially. This command will launch a web browser and request OAuth approval through the user’s browser. Once the request is completed, a Refresh Token for the Gmail API will be automatically issued. Before running this init command, please make sure to add http://localhost:8912/ to the redirect URLs in your Cloud Console settings.

# Create RefreshToken table First
./manage.py migrate

# Then get the RefreshToken
./manage.py init_gmail_oauth_token

Note: The Refresh Token is stored in the database and is used to automatically refresh the Access Token when it expires. The Google OAuth 2.0 refresh token typically does not have an expiration date, but if a refresh token becomes invalid or expires for other reasons, it will need to be reissued following the procedure above.

Credits

Authors & Contributors

Metadata

Release files for django-gmail-oauth-backend 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-gmail-oauth-backend 0.2.0
File Size Uploaded Provenance
django_gmail_oauth_backend-0.2.0.tar.gz 6.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for django-gmail-oauth-backend 0.2.0
File Interpreter ABI Platform
django_gmail_oauth_backend-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 14.8 kB

Release files / django_gmail_oauth_backend-0.2.0.tar.gz

Download URL django_gmail_oauth_backend-0.2.0.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
b9a06caa86e1bfc9d6c9c7509df919620a9bd390327bb599253c161b0def4909
BLAKE2b-256 checksum
How to use checksums
705a523408b69265fb8e4bc6887fb56fe721f4272bfa47c505cb47ab3a7e13ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.3

Release files / django_gmail_oauth_backend-0.2.0-py3-none-any.whl

Download URL django_gmail_oauth_backend-0.2.0-py3-none-any.whl
Size 8.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6cad081c6e03e3c56fe35d3585df521a41ffb5a5b323f7cf2316f2206dbadde7
BLAKE2b-256 checksum
How to use checksums
7f0fc21d859691b315e3af743ae5534febaf5fa3cc5683137c119b8face7300e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.3

Security for django-gmail-oauth-backend 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page