django-cognito-jwt | Authentication backend for Django Rest Framework | AWS library
kandi X-RAY | django-cognito-jwt Summary
kandi X-RAY | django-cognito-jwt Summary
An Authentication backend for Django Rest Framework for AWS Cognito JWT tokens
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Validate a JWT token .
- Get the RSA public key from a JWT token .
- Authenticate a JWT .
- Extract the JWT token from the request .
- Generate authentication header .
- Creates a token validator .
- Returns the URL for the resource pool .
- Returns a dictionary of key ids
- Initialize credentials .
- Returns the django user model .
django-cognito-jwt Key Features
django-cognito-jwt Examples and Code Snippets
Community Discussions
Trending Discussions on django-cognito-jwt
QUESTION
I'm trying to set up an AWS Cognito backend I have a React frontend already working with it, now I need my DRF API to authenticate using the Cognito as backend.
I have found a few Python packages for that, none of them seem to be actively maintained django-warrant doesn't work with Django3 and is pretty much dead
Django Cognito JWT seems to be my best bet, but also not actively maintained, the documentation is very poor, and there is a medium post on how to use, not very detailed, but better than nothing.
So, I tried to follow the documentation
Added the env vars on my settings
...ANSWER
Answered 2020-Feb-20 at 11:26Basically, there are 2 steps to achieve your goal.
- Get IdToken and AccessToken from Cognito by Boto3 library.
- Apply the IdToken in this Pattern
Authorization Bearer IdToken
to call API viacurl
.
Unlike rest_framework_jwt
, django_cognito_jwt
only deals with JWT token at header. django_cognito_jwt
does not cover step 1. That is why you are getting this error TypeError: authenticate() got an unexpected keyword argument 'email'
.
So, solution is use boto3 to get IdToken
and apply curl
by passing Authorization:Bearer IdToken
header.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install django-cognito-jwt
You can use django-cognito-jwt like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page