Skip to content

aws-cognito: oAuth.callbackUrls of UserPoolClient should not have http://example.com #28204

@jolo-dev

Description

@jolo-dev

Describe the bug

The property oAuth.callbackUrls of UserPoolClient should be mandatory when flows.authorizationCodeGrant or flows.implicitCodeGrant istrue otherwise, the oAuth.callbackUrls results into ['http://example.com'].

Expected Behavior

An error is thrown when oAuth.callbackUrls is empty but flows.authorizationCodeGrant or flows.implicitCodeGrant istrue.

Current Behavior

oAuth.callbackUrls results into ['http://example.com']

Reproduction Steps

declare const userPoolIdentityProviderOidc: UserPoolIdentityProviderOidc;
// 👇 code goes through
const userPoolClient = new UserPoolClient(this, 'UserPoolClient', {
      userPool,
      userPoolClientName: `${serviceName}-user-pool-client`,
      generateSecret: true,
      supportedIdentityProviders: [{
        name: userPoolIdentityProviderOidc.providerName,
      }],
      authFlows: {
        userPassword: true,
      },
      oAuth: {
        flows: {
          authorizationCodeGrant: true,
        },
      },
    });

Possible Solution

Either remove the default or put a guardrail or throw an error when flows.authorizationCodeGrant or flows.implicitCodeGrant istrue and oAuth.callbackUrls is not set.

Additional Information/Context

No response

CDK CLI Version

2.110.0

Framework Version

No response

Node.js Version

18.15

OS

macOS 14.1

Language

TypeScript

Language Version

5.2

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-cognitoRelated to Amazon CognitobugThis issue is a bug.effort/smallSmall work item – less than a day of effortp2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions