Home > Enterprise >  Retrieving JWT token from AWS Cognito in ASP.NET Core 3.1 MVC after successful authorization
Retrieving JWT token from AWS Cognito in ASP.NET Core 3.1 MVC after successful authorization

Time:01-28

I have followed this tutorial to produce a working Cognito authentication solution for my MVC app. However, I need access to the user's JWT token for further custom authentication permissions. I have learned that the /oauth2/token endpoint returns that token. My use case calls for the grant_type to be authorization_code, which means that I have to pass a code parameter to the endpoint. What value needs to be placed there actually? How do I produce it? Alternatively, is there any other way to retrieve/store the JWT anywhere in the application after a user passes authorization?

CodePudding user response:

It turns out the JWT of an authorized user can simply be accessed in the controller as in this solution: Oauth 2.0 How to access the access token saved in AuthenticationProperties , completely allowing us to bypass additional AWS calls.

  •  Tags:  
  • Related