External IDP Tokens in Cognito User Pools

2

Does Cognito User Pools store tokens granted by external IDPs (such as external access_token and refresh_token)? If so, how can they be accessed?

질문됨 2년 전1120회 조회
2개 답변
0

Hello,

You can create a custom attribute [1] in your user pool, and then you can map [2] that custom attribute with the attribute name sent from identity provider side token endpoint.

For example, your identity provider sends the access token with a attribute named access_token. Then, you can create a custom attribute external_access_token. And map custom:external_access_token with access_token in attribute mapping section of your user pool [2].

I have tested this solution for Google and it worked. If you want to have other tokens (id token or refresh token) then you can create another custom attribute and map it in similar way.

Note: Please note that there is a size limit on length of a custom attribute. If the token sent from your IdP is longer than 2048 characters then this solution will not work.

I hope this helps. In case you have any further queries/concerns then please let me know.

--References--

[1] https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-attributes.html

[2] https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-specifying-attribute-mapping.html#cognito-user-pools-specifying-attribute-mapping-console

AWS
지원 엔지니어
Tarit_G
답변함 2년 전
profile picture
전문가
검토됨 한 달 전
-1

You can get the user's tokens using the /oauth2/token endpoint.

AWS
답변함 2년 전

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

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

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