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,260 points
4,037 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
• 58,020 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,510 points
5,054 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,670 points
5,521 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
• 58,020 points
10,147 views
0 votes
1 answer
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
• 58,020 points
5,966 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP