After a user signs in through an Amazon Cognito user pool, a developer needs to display the user's name and email address on the application's profile screen. Which token should the application read these claims from?
Choose one.
Cognito's three tokens have distinct jobs: the ID token answers "who is the user" with profile claims, the access token answers "what may this caller do", and the refresh token silently renews the other two.
Profile data like name and email lives in the ID token's claims, which is exactly what a profile screen needs. The access token is the classic confusion: it authorizes API requests via scopes and groups but does not carry profile attributes. The refresh token is opaque to the application and only ever exchanged with Cognito. A SAML assertion, when federation is involved, is consumed by the user pool during brokering — the app still receives standard Cognito JWTs.
- Identify the need: identity information for display, not API authorization.
- Map identity claims to the ID token and authorization to the access token.
- Read name and email from the validated ID token's payload.
- Continue sending the access token, not the ID token, when calling scoped APIs.
Exam tip: ID token = identity claims for the app; access token = authorization for APIs.
Authentication and Authorization on AWS: Cognito, IAM, and STS — the lesson that teaches this.