Django authentication with AWS Cognito for your custom workflow
Project description
django-cognito-lowlevel
django-cognito-lowlevel is a Django package for handling authentication with AWS Cognito in a lower level way.
This package does not make any attempts at integrating with the Django user system directly. Handler for your callback function is provided for your own workflow customizations.
Installation of django-cognito-lowlevel
You can integrate django-cognito-lowlevel with your Django project using a Python virtual environment Please use pip to install at your Python virtual environment:
pip install django-cognito-lowlevel
Django settings that should and can be configured
The following variables are needed at the settings.py of your project.
Varaiable | Description & example |
---|---|
COGNITO_USER_POOL_ID |
User pool ID of your AWS Cognito setup. e.g. "eu-west-XXXXXXXX" |
COGNITO_CLIENT_ID |
Client ID of your AWS Cognito setup. e.g. "2vvdsdfr243rwefswe445rte5edr" |
COGNITO_APP_CLIENT_SECRET |
Client Secret of AWS Cognito setup. e.g. 1urj4uktvlmb0pps234234d6io8tipmrlu3se13fdssdf |
COGNITO_TOKEN_URL |
The Token URL of your AWS Cognito setup. e.g. "https://<xxxxxxxxxx>.auth.<eu-west-2>.amazoncognito.com/oauth2/token" |
COGNIT_CALLBACK_URL_PATH |
Call back path redirected from AWS Cognito. e.g. "some-folder-of-your-choice/api/cognito/userpool/callback/" |
COGNITO_REDIRECT_URL |
Add some random delay of 1 to 30 seconds for each HTTP requests. Disable by default. e.g. f"http://localhost:8000/{COGNIT_CALLBACK_URL_PATH}" |
COGNITO_HOST |
The host of your AWS Cognito setup. e.g. "<xxxxxxxxxx>.auth.<eu-west-2>.amazoncognito.com" |
COGNITO_USERPOOL_REGION |
Default AWS Cognito region Name. e.g. "us-west-2" |
COGNITO_AUTH_SUCCESS_REDIRECT_URL |
URL or Django URL route name of redirection upon success, after obtaining the access_token and id_token . e.g. "landing:index" |
COGNITO_AUTH_ERROR_REDIRECT_URL |
URL or Django URL route name of redirection upon error. e.g. "landing:error" |
COGNITO_PUBLIC_KEYS_CACHE_TIMEOUT |
Cache time of the public keys of your AWS Cognito setup. e.g. 300 |
Credits & Acknowledgements
Python packages dependencies
-
awslabs/aws-support-tools
Decode and verify Amazon Cognito JWT tokens
Copyright (c) Amazon Web Services - Labs Apache-2.0 license https://github.com/awslabs/aws-support-tools/tree/master/Cognito/decode-verify-jwt -
Django
Copyright (c) Django Software Foundation and individual contributors.
All rights reserved.
https://www.djangoproject.com/ -
Requests
Copyright (c) Kenneth Reitz & Python Software Foundation Apache-2.0 license https://github.com/psf/requests -
colorama
Copyright Jonathan Hartley & Arnon Yaari, 2013-2020. BSD-3-Clause license https://github.com/tartley/colorama -
python-jose
Copyright (c) Michael Davis MIT license https://github.com/mpdavis/python-jose
License
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/
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
Hashes for django_cognito_lowlevel-0.1.11.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 00354dd4b10c71af89b49d8adbc32632899898d7d47f9e2d26931773766cd9c9 |
|
MD5 | 27ed179e7fc5e03bb6f9b8ce641997ca |
|
BLAKE2b-256 | bbc55e57398a14b1facb3ad5fdb515a703e747e9d940e5ec6ac963e51b32456b |
Hashes for django_cognito_lowlevel-0.1.11-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 090e791408cf1d1ccf9c50197e4eb8711ef303dc98912338e6f91871f59a4980 |
|
MD5 | 5176521694e97763bf0d2a8d1286887d |
|
BLAKE2b-256 | 01aa205ce6ec4010d5076379fececdebf2cd0dcdb2ac144153138ceb7c65dc3f |