[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!

Rinor
已提問 5 個月前檢視次數 208 次
1 個回答
0

Do you verified if the advanced feature is active?

The access token generation is just available with advanced feature

profile picture
已回答 4 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南