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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file django_gmail_oauth_backend-0.1.3.tar.gz
.
File metadata
- Download URL: django_gmail_oauth_backend-0.1.3.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a955074e4ced4af0b995de3609523f7ea39a5c6a69dcde174361960f343d916b |
|
MD5 | 11e2a7f1a91b096766412b9cf08ce3ee |
|
BLAKE2b-256 | f79af3d1c8888494d0b792091ea9d087f2b253bfa5001d127bc4b3503d065a1c |
File details
Details for the file django_gmail_oauth_backend-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: django_gmail_oauth_backend-0.1.3-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | efa4f79ebdd583a9f98b82bcab2914ae78e789e3bfac72381bcc804ffa502467 |
|
MD5 | 702bc0aeb1615c7b844202999eb8c706 |
|
BLAKE2b-256 | d0cbe5805bd31e038c84036b5719df2450682d04fd7aa281898d0ead23dc00cf |