Skip to content

fix: include client_secret_expires_at in client registration response#164

Merged
mattzcarey merged 3 commits intocloudflare:mainfrom
pnguyen-atlassian:fix/client-secret-expiry
Mar 4, 2026
Merged

fix: include client_secret_expires_at in client registration response#164
mattzcarey merged 3 commits intocloudflare:mainfrom
pnguyen-atlassian:fix/client-secret-expiry

Conversation

@pnguyen-atlassian
Copy link
Contributor

Fixes #163

When a confidential client is registered and a client_secret is returned, the response was missing the client_secret_expires_at field required by RFC 7591 (OAuth 2.0 Dynamic Client Registration).

This change adds client_secret_expires_at: 0 to the registration response, indicating the secret does not expire. Clients that strictly follow the spec may reject responses without this field.

When a confidential client is registered and a client_secret is returned,
the response was missing the client_secret_expires_at field required by
RFC 7591 (OAuth 2.0 Dynamic Client Registration).

This change adds client_secret_expires_at: 0 to the registration response,
indicating the secret does not expire. Clients that strictly follow the spec
may reject responses without this field.
@changeset-bot
Copy link

changeset-bot bot commented Mar 3, 2026

🦋 Changeset detected

Latest commit: ca3976d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@cloudflare/workers-oauth-provider Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 4, 2026

Open in StackBlitz

npm i https://pkg.pr.new/cloudflare/workers-oauth-provider/@cloudflare/workers-oauth-provider@164

commit: ca3976d

…eset

- Add client_secret_issued_at to registration response (RFC 7591 §3.2.1)
- Assert secret fields are absent for public clients
- Add changeset for patch bump
@mattzcarey mattzcarey merged commit 4b640a3 into cloudflare:main Mar 4, 2026
4 checks passed
@github-actions github-actions bot mentioned this pull request Mar 4, 2026
mattzcarey pushed a commit that referenced this pull request Mar 4, 2026
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @cloudflare/workers-oauth-provider@0.3.0

### Minor Changes

- [#158](#158)
[`b26f7ff`](b26f7ff)
Thanks [@mattzcarey](https://github.com/mattzcarey)! - Add
`clientIdMetadataDocumentEnabled` option to make CIMD (Client ID
Metadata Document) support explicitly opt-in. Previously, CIMD
auto-enabled when the `global_fetch_strictly_public` compatibility flag
was present, which could cause crashes for servers where URL-shaped
client_ids hit bot-protected endpoints. When not enabled (the default),
URL-formatted client_ids now fall through to standard KV lookup instead
of throwing.

- [#144](#144)
[`49a1d24`](49a1d24)
Thanks [@mattzcarey](https://github.com/mattzcarey)! - Add
`revokeExistingGrants` option to `completeAuthorization()` that revokes
existing grants for the same user+client after creating a new one.
Defaults to `true`, fixing infinite re-auth loops when props change
between authorizations (issue #34). Set to `false` to allow multiple
concurrent grants per user+client.

Revoke tokens and grant when an authorization code is reused, per RFC
6749 §10.5. This prevents authorization code replay attacks by
invalidating all tokens issued from the first exchange.

**Breaking behavior change:** Previously, re-authorizing the same
user+client created an additional grant, leaving old tokens valid. Now,
old grants are revoked by default. If your application relies on
multiple concurrent grants per user+client, set `revokeExistingGrants:
false` to preserve the old behavior.

### Patch Changes

- [#164](#164)
[`4b640a3`](4b640a3)
Thanks [@pnguyen-atlassian](https://github.com/pnguyen-atlassian)! -
Include `client_secret_expires_at` and `client_secret_issued_at` in
dynamic client registration responses when a `client_secret` is issued,
per RFC 7591 §3.2.1.

- [#165](#165)
[`9cce070`](9cce070)
Thanks [@mattzcarey](https://github.com/mattzcarey)! - Use
`Promise.allSettled` instead of `Promise.all` for best-effort grant
revocation in `completeAuthorization()`, ensuring all grants are
attempted even if one fails.

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: client_secret_expires_at field not returned when client secret returned for confidential clients

2 participants