Skip to main content

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

Project description

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

Project details


Download files

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

Source Distribution

django_gmail_oauth_backend-0.2.0.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file django_gmail_oauth_backend-0.2.0.tar.gz.

File metadata

File hashes

Hashes for django_gmail_oauth_backend-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b9a06caa86e1bfc9d6c9c7509df919620a9bd390327bb599253c161b0def4909
MD5 45c68fa6cf2e2b52bcd7be9a97852b6b
BLAKE2b-256 705a523408b69265fb8e4bc6887fb56fe721f4272bfa47c505cb47ab3a7e13ed

See more details on using hashes here.

File details

Details for the file django_gmail_oauth_backend-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_gmail_oauth_backend-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6cad081c6e03e3c56fe35d3585df521a41ffb5a5b323f7cf2316f2206dbadde7
MD5 3b8ecc986d226d6916c0ad0c6c77c5c7
BLAKE2b-256 7f0fc21d859691b315e3af743ae5534febaf5fa3cc5683137c119b8face7300e

See more details on using hashes here.

Supported by

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