Packages

better-auth

1.7.25 · 14 Nov 2026MIT21M / weekRepositoryHomepagenpmAtom feed

Your version

1.7.0

18 Aug 2026Where it was published

1.7.27 is the newest release of 1.x.

In short

17 breaking24 new15 fixed

  • Breaking

    Moved database joins out of experimental into the stable advanced.database.joins option

  • Breaking

    Scoped account identity by trusted issuer, keying accounts on (issuer, accountId)

  • Breaking

    Required captcha endpoint entries to match full auth paths, with wildcard support

  • Breaking

    Moved the MCP plugin into its own @better-auth/mcp package built on the OAuth provider

  • Breaking

    Added OIDC back-channel logout so ending a session cuts off every connected app's API access

  • Breaking

    Modeled OAuth protected resources explicitly, with per-resource TTLs, scopes, claims, and signing pins

  • Breaking

    Decoupled SCIM provisioning from the organization plugin

  • Breaking

    Added OTP-only two-factor enablement with a discriminated enableTwoFactor response

Security

Fixes 1 advisory that affected 1.6.35

3 advisories affect 1.7.0; 1.7.7 fixes them

Release note

The section about better-auth of a note shared by several packages.

better-auth

Breaking Changes

  • Breaking

    Moved database joins out of experimental into the stable advanced.database.joins option

    Migration: Replace experimental: { joins: true } with advanced: { database: { joins: true } }. Drizzle and Prisma users should regenerate their schema (npx auth@latest generate) so it includes the required relations.

  • Breaking

    Scoped account identity by trusted issuer, keying accounts on (issuer, accountId)

    Migration: Accounts now require Account.issuer. Read provider identity from accountInfo.account.accountId, drop mapping.id from SSO configs, and give the microsoftEntraId helper a concrete tenant GUID. Apply the account-identity backfill in the 1.7 upgrade guide before deploying.

  • Breaking

    Required captcha endpoint entries to match full auth paths, with wildcard support

    Migration: Replace partial paths such as /sign-in with explicit wildcards like /sign-in/* or /sign-in/**.

  • Breaking

    Moved the MCP plugin into its own @better-auth/mcp package built on the OAuth provider

    Migration: Install @better-auth/mcp and @better-auth/cimd, add the now-required jwt() plugin, and move options nested under oidcConfig to flat mcp({ ... }) options. Rename withMcpAuth to requireMcpAuth and mcpHandler to createMcpProtectedRequestHandler. Regenerate the schema (npx auth migrate): oauthApplication becomes oauthClient, plus new oauthRefreshToken and oauthClientAssertion tables.

  • Breaking

    Added OIDC back-channel logout so ending a session cuts off every connected app's API access

    Migration: Introspecting an access token whose session has ended now returns { active: false }, and /oauth2/userinfo rejects it. Clients opt into notifications by registering backchannel_logout_uri. Run the schema migration for the new oauthClient and oauthAccessToken columns.

  • Breaking

    Modeled OAuth protected resources explicitly, with per-resource TTLs, scopes, claims, and signing pins

    Migration: validAudiences is removed: move each resource identifier into resources and link restricted clients through oauthClientResource. @better-auth/mcp now requires an explicit resource. Run npx @better-auth/cli generate and apply the migration before deploying.

  • Breaking

    Decoupled SCIM provisioning from the organization plugin

    Migration: SCIM configuration, client APIs, database schema, and the Group model are all replaced, and provisioning state cannot migrate in place. Follow the SCIM cutover in the 1.7 upgrade guide, including a full directory reprovision, before resuming traffic.

  • Breaking

    Added OTP-only two-factor enablement with a discriminated enableTwoFactor response

    Migration: enableTwoFactor now returns a method field ("otp" or "totp"); narrow on it before reading totpURI and backupCodes. Pass method: "otp" for OTP enrollment, which requires otpOptions.sendOTP.

  • Breaking

    Resolved the auth origin from Host by default when using a dynamic baseURL

    Migration: If your proxy exposes the public hostname only through x-forwarded-host, set advanced.trustedProxyHeaders: true. Deployments where the proxy rewrites Host (nginx default, Vercel, Cloudflare, Netlify) are unaffected.

  • Breaking

    Added unique lookup indexes for the device authorization deviceCode and userCode columns

    Migration: Resolve duplicate code values before applying the migration. MySQL and SQL Server installations must also convert both columns to bounded strings and clean up values longer than 191 characters.

  • Breaking

    Enforced S256 PKCE in the Electron sign-in flow and hardened custom-scheme origin checks

    Migration: Upgrade the @better-auth/electron client and server together and add your app's scheme to trustedOrigins. The code_challenge_method parameter and disableOriginOverride option are removed, and host-bearing custom-scheme entries now match that host exactly.

  • Breaking

    Identified Microsoft Entra accounts by the stable oid claim

    Migration: Migrate existing Microsoft account rows created from sub before upgrading. Tokens without a valid oid are rejected.

  • Breaking

    Required a Google client ID before Google One Tap verifies ID tokens

    Migration: Configure oneTap({ clientId }) or socialProviders.google.clientId.

  • Breaking

    Removed the deprecated oidcProvider plugin

    Migration: Move OIDC authorization-server integrations to @better-auth/oauth-provider.

  • Breaking

    Rewrote the generic OAuth plugin as a first-class social provider with OAuth 2.1 defaults

    Migration: Replace signIn.oauth2({ providerId }) with signIn.social({ provider }), oauth2.link() with linkSocial(), and drop genericOAuthClient(). Callbacks move to /api/auth/callback/:id, pkce now defaults to true, and issuer and requireIssuerValidation are removed in favor of OIDC discovery.

  • Breaking

    Separated OAuth device grant ownership into oauthDeviceAuthorization()

    Migration: The OAuth integration replaces the optional resource column with oauthClientId and resources, so regenerate and apply the schema. Let pending device codes expire before upgrading from an earlier 1.7 prerelease.

  • Breaking

    Verified provider id_tokens with a single shared verifier

    Migration: Custom UpstreamProvider implementations replace the removed verifyIdToken method with an idToken config carrying a JWKS source, issuer, and audience. PayPal client id_token sign-in now returns ID_TOKEN_NOT_SUPPORTED; its redirect flow is unchanged.

Features

  • Added clientAssertion support to the Microsoft Entra ID social provider

  • Made the Auth instance directly fetchable

  • Added per-provider requireEmailVerification for social sign-in

  • Added a user.validateUserInfo gate for rejecting an identity before a user is created or linked

  • Added hydrateSession so useSession returns server-fetched data on the first render

  • Added compound table indexes to plugin database schemas

  • Added allowIdpInitiated support for IdP-initiated flows through a secure server-side bounce

  • Added RP-initiated logout so signOut() can also sign users out of the OpenID provider

  • Added refreshTokenParams for forwarding extra parameters on generic OAuth token refresh

  • Verified discovery id_tokens against the provider JWKS and enabled id_token sign-in for generic OAuth

  • Added the OAuth device authorization grant (RFC 8628)

  • Added DPoP sender-constrained access tokens (RFC 9449)

  • Added the at_hash claim to ID tokens issued alongside an access token, per OIDC Core §3.1.3.6

  • Added private_key_jwt client authentication for token endpoint requests (RFC 7523)

  • Sent Cache-Control: no-store on every OAuth response that carries credentials

  • Added per-request additionalParams and loginHint across signIn.social, linkSocial, and signIn.sso

  • Added a server-trusted OAuth state channel, fixing anonymous account linking in in-app browsers

  • Allowed passing userId and organizationId to the listUserTeams API

  • Added organization.getOrganization() for metadata-only fetches

  • Added a server-only consumePhoneNumberOTP API for custom phone OTP flows

  • Added JWKS-backed asymmetric JWTs for the session cookie cache

  • Added transactional OIDC user resolution for SSO sign-ins

  • Added an immutable username option

  • Allowed omitting the username plugin's separate displayUsername field

Bug Fixes

  • Allowed test instances to enable native database transactions for PostgreSQL and MySQL.

  • Refreshed bundled dependencies (jose, nanostores, the noble crypto packages, and SimpleWebAuthn) to their latest compatible releases. These updates are backward compatible and require no changes to existing projects.

  • Widened the drizzle-kit peer dependency range

  • Decoupled the session cookie cache from JWT plugin internals

  • Allowed auth migrate to add required columns with static defaults and nullable unique columns to existing tables

  • Bound the ID token nonce to the authorization request in the generic OAuth redirect flow

  • Fixed a sign-up deadlock when JWT cookie caching ran on a single-connection SQLite database with native transactions

  • Created new OAuth accounts inside the user creation transaction

  • Derived the OAuth redirect_uri from the per-request base URL in multi-host deployments

  • Preserved previously granted account.scope values across re-authentication and token refresh

  • Preserved the resolved OAuth user when overrideUserInfo returns null

  • Fired session-delete hooks and revoked bound OAuth tokens for preserved sessions on secondaryStorage

  • Issued SIWE nonces before the wallet address and chain ID are known

  • Fixed client plugin composition so One Tap, Electron, and Expo type-check with createAuthClient

  • Single-sourced HTTP Basic credential encoding and decoding for OAuth client authentication

For detailed changes, see CHANGELOG

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.