问题
According to the documentation, the ID token (a JWT token) created by Cognito upon user authentication is also supposed to contain the custom attributes defined for the user's User Pool.
It seems that when the User Pool is configured with a SAML identity provider, the ID token does not contain those custom attributes of the user pool, but only the Cognito attributes which are mapped from the SAML token.
Note: the custom attribute is already configured when the user pool is created, therefore it does not make sense to set it up again in the SAML token, for example by configuring the remote AD FS attributes.
Is there any way to preserve a User Pool custom attribute in the ID token, in this case of using a federated identity provider? Or be able to hook into the authentication process to insert a custom attribute into the token?
Thanks for the help!
来源:https://stackoverflow.com/questions/49763113/cognito-user-pool-custom-attributes-do-not-show-up-in-the-id-token-if-user-pool