Skip to content

pulsely/django-cognito-lowlevel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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.

An example implementation is available at django-cognito-lowlevel-example.


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

Example implementation

Please refer to the django-cognito-lowlevel-example project.


Credits & Acknowledgements

Python packages dependencies

django-cognito-lowlevel is written by Pulsely https://www.pulsely.com/
Copyright ©2023 Pulsely

Amazon Cognito, AWS, and Amazon Web Services are trademarks or registered trademarks of Amazon.com, Inc. in the United States and/or other countries. This project is not endorsed by or affiliated with Amazon.com, Inc.

About

Django Cognito authentication for your custom workflow

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages