[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개 답변
0

Do you verified if the advanced feature is active?

The access token generation is just available with advanced feature

profile picture
답변함 4달 전

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

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

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

관련 콘텐츠