npm better-auth 1.8.0-beta.8
v1.8.0-beta.8

one hour ago

Important

Action required

  • If you set an Authorization entry in authorizationHeaders or pass authorization in headers to the @better-auth/core/oauth2 token request functions, remove it and set the header from customizeRequest with tokenEndpointAuth method custom, which must also set every credential the provider requires. (#12416)

  • feat(oauth)!: bind client-submitted ID tokens to a server-issued nonce (#11823)

    Apps where clients sign in or link accounts with a provider ID token (for example from a native Google or Apple SDK) can now bind each token to one request. Set requireIssuedIdTokenNonce: true on a social provider. Clients then fetch a single-use nonce with authClient.idToken.nonce({ provider }), pass it to the provider's SDK, and send it with the ID token to signIn.social or linkSocial. A request without an issued nonce, or reusing one, is rejected with 400 INVALID_ID_TOKEN_NONCE. The option is off by default, and providers without it behave as before.

    One change applies to every provider that uses built-in verification: an opaque (non-JWT) token, such as a Facebook Graph access token, is now rejected when the request also sends a nonce, because the token cannot carry one. A custom verifyIdToken must compare the nonce to the token's claim itself. Opaque tokens sent without a nonce are still accepted.

    Expired verification rows are now also deleted when a single-use value, such as a magic link, an OTP, or an issued nonce, is used. Before, cleanup ran only when a value was looked up. verification.disableCleanup turns off both.

  • If you call /one-tap/callback or auth.api.oneTapCallback yourself, call POST /one-tap/nonce first, pass the nonce to google.accounts.id.initialize({ nonce }), and send it as nonce in the callback body; if you set the client nonce option or a nonce in additionalOptions, remove it. (#11823)

  • If you use the built-in Kysely adapter, run npx auth@latest migrate; if you use Prisma or Drizzle, run npx auth@latest generate and apply the migration before deploying, to add the expiresAt column to oauthClient. MongoDB needs no migration. (#11802)

better-auth

❗ Breaking Changes

  • Changed generic OAuth to fail at startup when authorizationHeaders contains an Authorization entry, and made validateAuthorizationCode, authorizationCodeRequest, refreshAccessToken, and refreshAccessTokenRequest throw when passed authorization in headers (#12416)
  • feat(oauth)!: bind client-submitted ID tokens to a server-issued nonce (#11823)
  • Changed /one-tap/callback to require a single-use nonce from the new POST /one-tap/nonce endpoint so each Google ID token signs in only once (#11823)

For detailed changes, see CHANGELOG

@better-auth/core

❗ Breaking Changes

  • Changed generic OAuth to fail at startup when authorizationHeaders contains an Authorization entry, and made validateAuthorizationCode, authorizationCodeRequest, refreshAccessToken, and refreshAccessTokenRequest throw when passed authorization in headers (#12416)
  • feat(oauth)!: bind client-submitted ID tokens to a server-issued nonce (#11823)

Features

  • Added support for server-provided DPoP nonces in the OAuth provider through dpop: { nonce: { required: true } }, plus resource server support with verifyAccessTokenRequest, createResourceServerChallenge, and createDpopNonce (#12376)

For detailed changes, see CHANGELOG

@better-auth/oauth-provider

Features

  • Added support for server-provided DPoP nonces in the OAuth provider through dpop: { nonce: { required: true } }, plus resource server support with verifyAccessTokenRequest, createResourceServerChallenge, and createDpopNonce (#12376)

Bug Fixes

  • Fixed OAuth provider client secret expiry so it is saved, returned as client_secret_expires_at, and enforced with invalid_client at the token, introspection, and revocation endpoints (#11802)

For detailed changes, see CHANGELOG

@better-auth/mcp

Features

  • Added support for server-provided DPoP nonces in the OAuth provider through dpop: { nonce: { required: true } }, plus resource server support with verifyAccessTokenRequest, createResourceServerChallenge, and createDpopNonce (#12376)

For detailed changes, see CHANGELOG

Contributors

Thanks to everyone who contributed to this release:

@gustavovalverde

Full changelog: v1.8.0-beta.7...v1.8.0-beta.8

Don't miss a new better-auth release

NewReleases is sending notifications on new releases.