npm better-auth 1.7.27
v1.7.27

48 minutes ago

Important

Action required

  • If you have no key for jwks.keyPairConfig.alg and your newest key uses another jwks.keyPairConfigs algorithm, your ID tokens, /token JWTs, and cookie-cache JWTs change alg and kid on the next unpinned signature, so update verifiers that hard-code the old algorithm or never refetch the JWKS for an unknown kid. (#12655)
  • If you want to keep rejecting a client_uri on a different origin than the client_id, add "client_uri" to originBoundFields, which now defaults to ["post_logout_redirect_uris"]. (#12822)

better-auth

Bug Fixes

  • Fixed the phone number plugin returning a 500 instead of a 400 from /update-user when the request has no body (#12810)
  • Fixed the username plugin returning a 500 on /sign-up/email and /update-user when the request has no body; it now returns the same 400 as without the plugin (#12810)
  • Fixed /sign-in/anonymous to validate the request origin, returning a 403 for browser requests from origins outside trustedOrigins (#12809)
  • Fixed unpinned tokens such as ID tokens and session JWTs to prefer a key for the primary jwks.keyPairConfig.alg algorithm (#12655)
  • Fixed getTestInstance from better-auth/test to run every instance cleanup even when one fails, so databases and connections are not left open (#12553)
  • Fixed POST requests without a body, such as /sign-out or /revoke-sessions, failing with a 415 on Deno, Next.js, Nuxt and other servers that pass an empty body stream (#12805)

For detailed changes, see CHANGELOG

@better-auth/oauth-provider

Features

  • Added the isCrossOriginJwksUriAllowed option to cimd() so you can accept Client ID Metadata Document clients whose jwks_uri is on a different origin than their client_id (#12823)
  • Fixed administrator updates to discovered clients that publish keys at a jwks_uri, such as setting client_credentials_scopes through adminUpdateOAuthClient (#12823)
  • Added the jwksStaleIfError option to keep verifying client assertions with cached jwks_uri keys while refetching fails transiently (#12824)
  • Added the requireOpenId option to oauthProvider to reject /oauth2/authorize requests that lack the openid scope with invalid_scope (#12729)
  • Added the resourceSeedScope option to oauthProvider so apps that build Better Auth on every request can stop re-reading oauthResource each time (#12733)
  • Added advertisedMetadata.token_endpoint_auth_methods_supported so providers can advertise accepted token endpoint client authentication methods, including public clients (#12732)

Bug Fixes

  • Fixed Client ID Metadata Document and jwks_uri responses refused before their body is read, such as error statuses or non-JSON content types, holding connections open (#12819)
  • Fixed the signed OAuth query failing with invalid_signature when a proxy, router, or login page URL-decodes it once (#12728)
  • Fixed the end-session endpoint to accept issued ID token hints when the issuer ends with a trailing slash (#12713)
  • Fixed signing keys and post-logout redirect URIs removed from a client's metadata document continuing to work after a refresh (#12821)
  • Fixed concurrent first requests from the same Client ID Metadata Document client failing with a server error when the database wraps the unique-constraint error (#12820)
  • Fixed refresh tokens without offline_access to stop working once their session expires or is deleted (#12812)
  • Fixed a client losing its offline_access grants on other devices after using a session-bound refresh token following sign-out (#12812)
  • Fixed oauthProviderClient to send form-encoded bodies as form fields and leave non-object JSON bodies such as arrays unchanged (#12726)
  • Fixed oauthProviderClient to stop rewriting request bodies on pages whose query string is not a signed OAuth query (#12726)
  • Fixed back-channel logout, jwks_uri client authentication, and Client ID Metadata Document fetches failing on Cloudflare Workers (#12817)
  • Fixed OIDC SSO sign-in with signIn.sso to resume the OAuth authorization instead of leaving the user on the sign-in callbackURL (#12727)
  • Fixed private_key_jwt clients losing their cached jwks_uri key set while still authenticating when more than 500 key sets are cached (#12721)
  • Improved private_key_jwt authentication so concurrent assertions for the same jwks_uri share a single fetch of the client's key set (#12721)
  • Fixed /oauth2/introspect to return the client ID as sub for JWT client_credentials tokens issued to pairwise clients (#12671)

For detailed changes, see CHANGELOG

@better-auth/cimd

Features

  • Added the isCrossOriginJwksUriAllowed option to cimd() so you can accept Client ID Metadata Document clients whose jwks_uri is on a different origin than their client_id (#12823)
  • Added the opt-in metadataStaleIfError option to keep known clients working through brief metadata host outages (#12824)

Bug Fixes

  • Fixed Client ID Metadata Document and jwks_uri responses refused before their body is read, such as error statuses or non-JSON content types, holding connections open (#12819)
  • Fixed @better-auth/cimd/node keeping connections open after bodyless responses such as 304 Not Modified to a metadata revalidation (#12819)
  • Fixed client metadata and JWKS fetches through @better-auth/cimd/node hanging forever when the server answers with 101 Switching Protocols (#12819)
  • Fixed requests hanging forever when they join a Client ID Metadata Document fetch that never settles (#12731)
  • Fixed concurrent requests for the same Client ID Metadata Document sharing one request's database save instead of each saving the client in their own context (#12731)
  • Fixed Client ID Metadata Document fetches that never settle permanently using up fetch slots and making other clients fail with temporarily_unavailable (#12731)
  • Fixed Client ID Metadata Documents with a client_uri on a different origin than the client_id being rejected under the default options (#12822)
  • Fixed client metadata and JWKS fetches in @better-auth/cimd/node staying stuck on DNS lookups after the request is aborted (#12818)
  • Fixed back-channel logout, jwks_uri client authentication, and Client ID Metadata Document fetches failing on Cloudflare Workers (#12817)

For detailed changes, see CHANGELOG

@better-auth/core

Bug Fixes

  • Fixed valid access tokens being rejected when the JWKS refetch fails by falling back to a cached key set fetched less than 10 minutes ago (#12722)
  • Fixed overlapping requests reading each other's request state in the edge and browser build by using the runtime's AsyncLocalStorage when available (#12807)

For detailed changes, see CHANGELOG

Contributors

Thanks to everyone who contributed to this release:

@bytaesu, @deepanshupal, @devsouhardo, @EhsanulHaqueSiam, @ghazy2001, @gustavovalverde, @hardikguptaofficialgit, @kaiizer777, @Neekoras, @NoiceHax, @officialasishkumar, @rendermani

Full changelog: v1.7.26...v1.7.27

Don't miss a new better-auth release

NewReleases is sending notifications on new releases.