2

I have a cognito userpool with a custom attribute. Attribute is mutable and the type is Boolean. But it is missing from the ID token

I tried following things

  • In App client explicitly made the attribute readable / writable
  • Unticked all the attributes to make them all readable / writable
  • Enabled OAuth scopes - Profile

None of them worked. How do I add custom attributes to the ID token?

It worked yesterday.
  • 4,507
  • 11
  • 46
  • 81
  • Does this answer your question? [Custom attribute not passed into ID\_TOKEN created by AWS Cognito](https://stackoverflow.com/questions/54530776/custom-attribute-not-passed-into-id-token-created-by-aws-cognito) – yudhiesh Jan 21 '21 at 06:07
  • @yudhiesh Nope tried them all.. did nt work – It worked yesterday. Jan 21 '21 at 06:11
  • Have you tried asking AWS Support? – yudhiesh Jan 21 '21 at 06:12
  • @yudhiesh AWS support is very slow, and really hard to find information from their docs.. hence did not go to their support.. Instead I came to SO. But went through all of the similar threads in their support forums, github issues etc. – It worked yesterday. Jan 21 '21 at 06:14

1 Answers1

3

Finally found a fix for this

In my case, I did not receive the attribute as it did not contain any value. The attribute will only be included in the token only if it contains a value

Important points found on research:

  • Make sure your attribute is readable. You can do this by visiting App clients -> Show details -> Set attribute read and write permissions (Insignificant link in the bottom.) -> tick your attribute that you want to be included in the token

  • If you are adding the attribute to an existing user pool, then you can not make it required.

It worked yesterday.
  • 4,507
  • 11
  • 46
  • 81
  • Thank you! Finding App Clients -> Show Details -> Set Attribute read/write was killing me! – L Co Jun 29 '21 at 20:28