generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 51
Open
Description
When verifying tokens issued from a Cognito identity pool (instead of a user pool), one must use the generic JwtVerifier rather than the CognitoJwtVerifier, with the following issuer and JWKS uri:
import { JwtVerifier } from "aws-jwt-verify";
const verifier = JwtVerifier.create({
issuer: "https://cognito-identity.amazonaws.com",
audience: "us-east-1:1-2-3-4-5", // <- would be your identity pool id
jwksUri: "https://cognito-identity.amazonaws.com/.well-known/jwks_uri",
});
try {
const payload = await verifier.verify("eyJraWQ...");
console.log("Token is valid. Payload:", payload);
} catch {
console.log("Token not valid!");
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels