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.5.tar.gz
.
File metadata
- Download URL: django_gmail_oauth_backend-0.1.5.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d88a1cbfb2e280f35c820dcce26f0762f5139bb573038ff09e73afaccd74e2c |
|
MD5 | d1293ef33941791081f9073552b33e95 |
|
BLAKE2b-256 | b619d2c15f74273dcfc0c9d52f7a2647582e3c14484daf15db443a3135149a8e |
File details
Details for the file django_gmail_oauth_backend-0.1.5-py3-none-any.whl
.
File metadata
- Download URL: django_gmail_oauth_backend-0.1.5-py3-none-any.whl
- Upload date:
- Size: 7.8 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 | eb3d8c1747338c53c147757ada2ae2455c8a6498cb2e8a482ab9afb05782f04a |
|
MD5 | 39d5c1f8d8a786c4219cf90ee3529bce |
|
BLAKE2b-256 | 665c786e9ea84e6030160182ab445874260df1bca5273a16cb22c0de30877370 |