v26.4.24
v26.4.24
Loopback redirect URIs must match exactly except for the port
Redirect URIs on 127.0.0.1 and [::1] still accept any port, but everything else must now match the registered URI character
for character, as RFC 8252 requires. Hydra previously compared the decoded path and ignored user information and empty query
strings, so http://127.0.0.1:54321/a%2Fb matched a registered http://127.0.0.1/a/b.
Breaking changes
An authorization request whose loopback redirect URI matched a registered URI only after decoding or normalization now fails with
invalid_request. This includes a redirect URI that differs from the registered one in percent-encoding, user information, an
empty query string (?), or the case of the scheme. For example, HTTP://127.0.0.1:54321/callback no longer matches a registered
http://127.0.0.1/callback.
Send the redirect URI exactly as registered, apart from the port, or register the URI your app sends.
Manage OAuth2 clients whose ID is a URL through the admin API
The routes under /admin/clients/{id} accept the client ID in a client_id query parameter, with - as the path segment. Use it
for client IDs that contain /, such as the URL of a client ID metadata document, because proxies often reject an encoded / in
a path. On Ory Network, this is the only way to address such a client:
GET /admin/clients/-?client_id=https%3A%2F%2Fapp.example.com%2Fclient.json.
Requests without the parameter work as before. The Hydra CLI uses the query form for client IDs that need escaping. See Address a client whose ID is a URL.
Breaking change in the TypeScript SDK
In @ory/client, the positional client functions of OAuth2ApiFp and OAuth2ApiAxiosParamCreator take a new optional clientId
argument before options and before any optional request body. The OAuth2Api class is unchanged.
Expired assertion IDs are cleaned up outside of token requests
Ory Hydra records the jti of every private_key_jwt client assertion and JWT bearer grant assertion to reject reused
assertions. Token requests no longer delete expired records. Instead:
- On CockroachDB with Ory Enterprise License, a row-level TTL deletes them.
- On all databases,
hydra janitor --tokensdeletes them.
If you use PostgreSQL, MySQL, SQLite, or YugabyteDB, run hydra janitor --tokens regularly. Otherwise the
hydra_oauth2_jti_blacklist table keeps growing.
A jti stays known after its assertion expires, until one of these cleanups deletes it. A new assertion that reuses the jti is
rejected until then. The jti must be unique for each assertion, as RFC 7519 requires.
If two JWT bearer grant requests send an assertion with the same jti at the same time, the second one now fails with jti_known
instead of server_error.
In fosite, ClientManager.ClientAssertionJWTValid and RFC7523KeyStorage.IsJWTUsed are removed. SetClientAssertionJWT and
MarkJWTUsedForTime report a known jti with fosite.ErrJTIKnown, including one whose expiry has passed.
Loopback redirect URIs on localhost accept any port
A client that registers an http redirect URI on localhost without a port can now send that URI with any port, if the
authorization request sets response_type=code and sends a PKCE code challenge with code_challenge_method=S256. For example,
http://localhost/callback matches http://localhost:54321/callback. Until now, only 127.0.0.1 and [::1] accepted any port.
A localhost redirect URI registered with a port, such as http://localhost:3000/callback, still matches only that port.
Native apps and MCP clients that listen on a random local port, such as Claude Code, can now sign in with a localhost redirect
URI. This includes clients resolved from a client ID metadata document. The scheme, host, path, and query must still match
exactly.
RFC 8252 requires any-port matching only for loopback IP addresses and recommends them over localhost. Hydra accepts localhost
for compatibility with existing clients. New clients should still use http://127.0.0.1 or http://[::1].