Skip to content

feat(cognito): support SecretValue for OIDC identity provider client secret - #39564

Open
Tharaka-Chathuranga wants to merge 1 commit into
aws:mainfrom
Tharaka-Chathuranga:feat/cognito-oidc-client-secret-value
Open

Tharaka-Chathuranga wants to merge 1 commit into
aws:mainfrom
Tharaka-Chathuranga:feat/cognito-oidc-client-secret-value

Conversation

@Tharaka-Chathuranga

Copy link
Copy Markdown

Issue # (if applicable)

Closes #29851.

Reason for this change

UserPoolIdentityProviderOidc only accepts the client secret as a plain string, so there's no way to pass it in as a SecretValue (e.g. from Secrets Manager) like you can with the Google and Apple providers.

Description of changes

  • Added clientSecretValue?: SecretValue to UserPoolIdentityProviderOidcProps.
  • Made clientSecret optional and deprecated it in favour of clientSecretValue. Existing code that passes clientSecret keeps working and produces the same template.
  • Exactly one of clientSecret / clientSecretValue has to be set, otherwise a ValidationError is thrown. I reused the ExactlyOneClientSecretClient error code from the Google provider since it's the same problem.
  • Added an example to the README.

This follows the same approach as #22885 (Google) and #31409 (Apple). Two small differences from those:

  • The check uses === undefined instead of truthiness so token values aren't treated as missing.
  • The error message is lowercase without a trailing period to match the current error message guidelines. Happy to make it match the Google/Apple wording exactly if you'd rather keep them consistent.

Describe any new or updated permissions being added

None.

Description of how you validated changes

  • Unit tests: added tests for clientSecretValue (Secrets Manager reference ends up in ProviderDetails.client_secret), for setting both props, and for setting neither. Moved the existing tests over to clientSecretValue and kept a testDeprecated test for the old clientSecret prop.
  • Integ test: added a second OIDC provider to integ.user-pool-idp.oidc that reads its client secret from a Secret created in the stack. The existing provider's resources are unchanged. Snapshot was updated with --dry-run, I haven't deployed it.

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

…secret

UserPoolIdentityProviderOidc only took the client secret as a plain
string, so it always ended up in the synthesized template. Add a
clientSecretValue prop that accepts a SecretValue (for example a
Secrets Manager secret) and deprecate clientSecret, the same way it
was done for the Google provider.

Closes aws#29851
@github-actions github-actions Bot added effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2 beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK labels Oct 29, 2026

This branch was successfully deployed

1 active deployment
automation — 85983018 Deployed Oct 29, 2026 by Tharaka-Chathuranga via validate-pr #375560
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

aws_cognito: UserPoolIdentityProviderOidc doesn't support SecretValue for client secret

1 participant