better-auth
1.7.25 · 14 Nov 2026MIT21M / weekRepositoryHomepagenpmAtom feed
1.7.27 is the newest release of 1.x.
In short
17 breaking24 new15 fixed
- Breaking
Moved database joins out of
experimentalinto the stableadvanced.database.joinsoption - 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/mcppackage 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
enableTwoFactorresponse
Security
Fixes 1 advisory that affected 1.6.35
- Highbetter-auth: Device login approval does not show the requesting client or permissionsGHSA-q84f-53jg-9ppm · 27 Oct 2026Fixed in 1.7.0
3 advisories affect 1.7.0; 1.7.7 fixes them
- Criticalbetter-auth: OAuth state can be used as a Magic Link to sign in as another userGHSA-965c-763c-88jm · 27 Oct 2026Fixed in 1.7.7
- Highbetter-auth: OAuth Proxy lets an attacker sign in as another userGHSA-r4xp-prcw-77qf · 27 Oct 2026Fixed in 1.7.7
- Low@better-auth/drizzle-adapter: Concurrent requests can exceed rate limits on PostgreSQLGHSA-44jh-23m7-hpcf · 27 Oct 2026Fixed in 1.7.7
Release note
The section about better-auth of a note shared by several packages.
better-auth
Breaking Changes
- Breaking
Moved database joins out of
experimentalinto the stableadvanced.database.joinsoptionMigration: Replace
experimental: { joins: true }withadvanced: { 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 fromaccountInfo.account.accountId, dropmapping.idfrom SSO configs, and give themicrosoftEntraIdhelper 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-inwith explicit wildcards like/sign-in/*or/sign-in/**. - Breaking
Moved the MCP plugin into its own
@better-auth/mcppackage built on the OAuth providerMigration: Install
@better-auth/mcpand@better-auth/cimd, add the now-requiredjwt()plugin, and move options nested underoidcConfigto flatmcp({ ... })options. RenamewithMcpAuthtorequireMcpAuthandmcpHandlertocreateMcpProtectedRequestHandler. Regenerate the schema (npx auth migrate):oauthApplicationbecomesoauthClient, plus newoauthRefreshTokenandoauthClientAssertiontables. - 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/userinforejects it. Clients opt into notifications by registeringbackchannel_logout_uri. Run the schema migration for the newoauthClientandoauthAccessTokencolumns. - Breaking
Modeled OAuth protected resources explicitly, with per-resource TTLs, scopes, claims, and signing pins
Migration:
validAudiencesis removed: move each resource identifier intoresourcesand link restricted clients throughoauthClientResource.@better-auth/mcpnow requires an explicitresource. Runnpx @better-auth/cli generateand 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
enableTwoFactorresponseMigration:
enableTwoFactornow returns amethodfield ("otp"or"totp"); narrow on it before readingtotpURIandbackupCodes. Passmethod: "otp"for OTP enrollment, which requiresotpOptions.sendOTP. - Breaking
Resolved the auth origin from
Hostby default when using a dynamicbaseURLMigration: If your proxy exposes the public hostname only through
x-forwarded-host, setadvanced.trustedProxyHeaders: true. Deployments where the proxy rewritesHost(nginx default, Vercel, Cloudflare, Netlify) are unaffected. - Breaking
Added unique lookup indexes for the device authorization
deviceCodeanduserCodecolumnsMigration: 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/electronclient and server together and add your app's scheme totrustedOrigins. Thecode_challenge_methodparameter anddisableOriginOverrideoption are removed, and host-bearing custom-scheme entries now match that host exactly. - Breaking
Identified Microsoft Entra accounts by the stable
oidclaimMigration: Migrate existing Microsoft account rows created from
subbefore upgrading. Tokens without a validoidare rejected. - Breaking
Required a Google client ID before Google One Tap verifies ID tokens
Migration: Configure
oneTap({ clientId })orsocialProviders.google.clientId. - Breaking
Removed the deprecated
oidcProviderpluginMigration: 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 })withsignIn.social({ provider }),oauth2.link()withlinkSocial(), and dropgenericOAuthClient(). Callbacks move to/api/auth/callback/:id,pkcenow defaults totrue, andissuerandrequireIssuerValidationare removed in favor of OIDC discovery. - Breaking
Separated OAuth device grant ownership into
oauthDeviceAuthorization()Migration: The OAuth integration replaces the optional
resourcecolumn withoauthClientIdandresources, so regenerate and apply the schema. Let pending device codes expire before upgrading from an earlier 1.7 prerelease. - Breaking
Verified provider
id_tokenswith a single shared verifierMigration: Custom
UpstreamProviderimplementations replace the removedverifyIdTokenmethod with anidTokenconfig carrying a JWKS source, issuer, and audience. PayPal clientid_tokensign-in now returnsID_TOKEN_NOT_SUPPORTED; its redirect flow is unchanged.
Features
Added
clientAssertionsupport to the Microsoft Entra ID social providerMade the
Authinstance directly fetchableAdded per-provider
requireEmailVerificationfor social sign-inAdded a
user.validateUserInfogate for rejecting an identity before a user is created or linkedAdded
hydrateSessionsouseSessionreturns server-fetched data on the first renderAdded compound table indexes to plugin database schemas
Added
allowIdpInitiatedsupport for IdP-initiated flows through a secure server-side bounceAdded RP-initiated logout so
signOut()can also sign users out of the OpenID providerAdded
refreshTokenParamsfor forwarding extra parameters on generic OAuth token refreshVerified discovery
id_tokensagainst the provider JWKS and enabledid_tokensign-in for generic OAuthAdded the OAuth device authorization grant (RFC 8628)
Added DPoP sender-constrained access tokens (RFC 9449)
Added the
at_hashclaim to ID tokens issued alongside an access token, per OIDC Core §3.1.3.6Added
private_key_jwtclient authentication for token endpoint requests (RFC 7523)Sent
Cache-Control: no-storeon every OAuth response that carries credentialsAdded per-request
additionalParamsandloginHintacrosssignIn.social,linkSocial, andsignIn.ssoAdded a server-trusted OAuth state channel, fixing anonymous account linking in in-app browsers
Allowed passing
userIdandorganizationIdto thelistUserTeamsAPIAdded
organization.getOrganization()for metadata-only fetchesAdded a server-only
consumePhoneNumberOTPAPI for custom phone OTP flowsAdded 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
displayUsernamefield
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-kitpeer dependency rangeDecoupled the session cookie cache from JWT plugin internals
Allowed
auth migrateto add required columns with static defaults and nullable unique columns to existing tablesBound the ID token
nonceto the authorization request in the generic OAuth redirect flowFixed 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_urifrom the per-request base URL in multi-host deploymentsPreserved previously granted
account.scopevalues across re-authentication and token refreshPreserved the resolved OAuth user when
overrideUserInforeturnsnullFired session-delete hooks and revoked bound OAuth tokens for preserved sessions on
secondaryStorageIssued SIWE nonces before the wallet address and chain ID are known
Fixed client plugin composition so One Tap, Electron, and Expo type-check with
createAuthClientSingle-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.