trouble getting userinfo from id_token in Cognito

0

After performing an .....amazoncognito.com/login?.... via the hosted web UI, I am correctly redirected to the callback URL with a query param "id_token" that I can use to access my API Gateway endpoints via x-api-key.

I am wanting to use the ID token to get the Cognito user info associated with that token (for verifying in my API that the token will allow for access to data that should only be accessed by that user).

How can I get the Cognito User ID, email etc? the ....amazoncognito.com/ouath2/userinfo seems like what i need but don't know how to correctly use that endpoint with the ID_token I have.

Lehel
질문됨 2년 전1495회 조회
1개 답변
0

Hi,

The ID Token is a JWT Token. The payload section of the JWT token should have the user info that you are looking for.

I'd recommend checking out the following documentation and knowledge center article:

  1. Using the ID token
  2. How can I decode and verify the signature of an Amazon Cognito JSON Web Token?
AWS
지원 엔지니어
Ryan_A
답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠