You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(oauth): allow public clients to exchange + refresh tokens without a secret
The token endpoint declared `client_secret` as a required parameter, so a
public client (SPA / native app, `confidential: false`) that authenticates
with PKCE — Backoffice, for example — was rejected with a 422
"missing required parameter 'client_secret'" before any OAuth logic ran.
Doorkeeper made `client_secret` optional for public clients and skipped
client-secret validation for them. This restores that:
- `token` now takes `client_secret : String? = nil`.
- `AuthlyAdapter::Client#authorized?` returns true for public clients
(they authenticate via PKCE); confidential clients still require a
constant-time secret match.
- `allowed_grant_type?` denies `client_credentials` to public clients, so
the secret bypass can't be used to mint owner-scoped tokens from a
(public) client_id.
- Discovery advertises `token_endpoint_auth_methods_supported: [..., "none"]`.
PKCE is left optional (matching Doorkeeper); enforcement can be enabled
later via `Authly.config.enforce_pkce`.
Specs updated: fixtures that authenticate with a real secret now model a
confidential client, and a new "public client" block covers the
no-secret code exchange + refresh and the client_credentials denial.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
0 commit comments