Validate a jwt token from cognito

0 votes

I used a jwt token that I have retrieved from cognito after my user logs in. I want that only valid user with valid jwt can access this. I tried many things but none worked.

I would really appreciate if someone would describe in detail the steps that i need to follow to verify my jwt.

Please provide the code if possible.

@CrossOrigin
@RequestMapping(value= "/login", method=RequestMethod.POST,consumes="application/json")
@ResponseBody
public String authenticate(@RequestBody SignInDTO signInDetails)
{
    //boolean isAuthenticated=false;
        CognitoHelper cognitoHelper=new CognitoHelper();
        String authResult=cognitoHelper.ValidateUser(signInDetails.getEmailId(), signInDetails.getPassword());
.....
.....
.....

authResult is the jwt that i get from cognito. After this I am completely clueless about what needs to be done.

Oct 31, 2018 in AWS by findingbugs
• 3,140 points
356 views

1 answer to this question.

0 votes

Here is a documentation on how to verify token Here's 

Here's where the key resides:

https://cognito-idp.$regionName.amazonaws.com/$cognitoUserPoolId/.well-known/jwks.json

answered Oct 31, 2018 by Priyaj
• 56,520 points

Related Questions In AWS

+5 votes
2 answers

Can we export/migrate users from AWS cognito, does it cause vendor lock-in?

Cognito actually has the capability to import ...READ MORE

answered Aug 1, 2018 in AWS by bug_seeker
• 15,350 points
814 views
0 votes
1 answer

Want to use an AWS Cognito User Pool without putting a password(for an easier approach)

Currently, AWS Cognito is not supporting passwordless ...READ MORE

answered May 4, 2018 in AWS by Cloud gunner
• 4,260 points
1,384 views
0 votes
1 answer
0 votes
1 answer

how to access AWS S3 from Lambda in VPC

With boto3, the S3 urls are virtual by default, ...READ MORE

answered Sep 28, 2018 in AWS by Priyaj
• 56,520 points
1,674 views
0 votes
1 answer
0 votes
1 answer
+2 votes
2 answers

How do we move a domain from Hostgator to AWS Route 53?

I found this  Before transferring a domain, make ...READ MORE

answered Aug 3, 2018 in AWS by Priyaj
• 56,520 points
887 views
0 votes
1 answer