[BUG] The new feature to add claims to access_tokens does NOT work

0

Amazon two days ago introduced a new feature in Amazon Cognito user pools, allowing for the customization access tokens. Detailed documentation on this update can be found in their recent release note: Amazon Cognito user pools now support the ability to customize access tokens.

Despite the update, I'm facing an issue where the customization seems to work only for ID tokens and not for access tokens. To give you a better idea, here's the Lambda function I'm using (V2 event):

const handler = async (event) => {
  // V2
  event.response = {
    claimsAndScopeOverrideDetails: {
      accessTokenGeneration: {
        claimsToAddOrOverride: {
          my_first_attribute: "first_value",
          my_second_attribute: "second_value",
        }
      },
      idTokenGeneration: {
        claimsToAddOrOverride: {
          my_first_attribute: "first_value",
          my_second_attribute: "second_value",
        }
      }
    },
  };

  return event;
};

export { handler };

I've double-checked the AWS CLI (version 1.32.4) to ensure that the correct Lambda version is linked to the user pool:

     "LambdaConfig": {
            "PreTokenGeneration": "<redacted>",
            "PreTokenGenerationConfig": {
                "LambdaVersion": "V2_0",
                "LambdaArn": "<redacted>"
            }
        },

Has anyone else experienced this issue or have insights on why the access token customization isn't working as intended? Any advice or suggestions would be greatly appreciated!

1 Risposta
0

Do you verified if the advanced feature is active?

The access token generation is just available with advanced feature

profile picture
con risposta 4 mesi fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande