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

Uploaded Source

Built Distribution

File details

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

File metadata

File hashes

Hashes for django_gmail_oauth_backend-0.1.7.tar.gz
Algorithm Hash digest
SHA256 1cd34efafc5d730b3e367980173913034cc40e67d5ca1d12059a863f0621a268
MD5 14b8990c9b3aef5efb8ead0de7c290fd
BLAKE2b-256 7e1ef8497df49371ca8e5dfee70d33dcea5c3661413ae2f106951bb0e7843ae9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_gmail_oauth_backend-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 32a80a9889a6e384421915e5f5385f13c3201cddc7c910e055a5e093f4c38acf
MD5 35fa52958da4d50876a536abdeb8a35e
BLAKE2b-256 1b5d604c98b945b5fa0ba8dacf06d56238ef3f0d6dd4df0c7ae56a6243594d3b

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