Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Cognito in react js with django rest framework?

I want to integrate third party authentication with AWS Cognito in my webapp. I have a React JS app with a django backend.

I found this tutorial but I dont really get how this will work with an existing frontend application rather than how to implement it.

if a user logs into the frontend and is authenticated via cognito (other question: is a backend in Amplify necessary?), can the token be passed to the django API - does cognito then need to be called again in django? this step is not yet completely clear to me.

Any help is appreciated. Are there no examples for react + DRF?

like image 888
alexrogo Avatar asked Oct 11 '25 20:10

alexrogo


1 Answers

The tutorial that you read shows the correct way to implement it on the backend. In your react frontend, you will use Amplify to get the token. When you are making an API call from your React API, pass the token to your API via the HTTP header Authorization with the value Bearer <access_token>.

like image 55
hithacker Avatar answered Oct 14 '25 14:10

hithacker