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.1.6.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

File details

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

File metadata

File hashes

Hashes for django_gmail_oauth_backend-0.1.6.tar.gz
Algorithm Hash digest
SHA256 ff751d47210db7ad8fa63a7024bcdc7cf3557a0e4d22f55eb778cade122afb60
MD5 e61a02a19773050b0d3c5094e6026414
BLAKE2b-256 362d685dc3bfd07ca132b1b14db9ce9b9603b8c353189776873dbbfedb7f50fb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_gmail_oauth_backend-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 b477cebfd5a39f0bd921a1cb33e357987e8ed502a8c581864b273813e149c2e9
MD5 098524f0ffdbc5e7475b9dc2e2e43efb
BLAKE2b-256 35a64919c77ec3de99237ab0c014ef072abf17fde7232e620ae5ca611efa8705

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