better-authfeat(two-factor)!: add OTP enablement and discriminated response (#9057)
enableTwoFactor now accepts a method parameter ("otp" | "totp", default "totp") and returns a discriminated response with a method field.
method: "otp"twoFactorEnabled: true immediately.{ method: "otp" }.otpOptions.sendOTP to be configured on the server; rejects with OTP_NOT_CONFIGURED otherwise.method: "totp" (default){ method: "totp", totpURI, backupCodes }.TOTP_NOT_CONFIGURED if totpOptions.disable is set.skipVerificationOnEnable: use method: "otp" for immediate activation, or the standard TOTP verification flow.enableTwoFactor includes a method field in the response ("otp" or "totp").operationId in password reset callback endpoint (#9072)For detailed changes, see CHANGELOG
@better-auth/ssofix(sso)!: harden SAML response validation (InResponseTo, Audience, SessionIndex) (#9055)
allowIdpInitiated now defaults to false — IdP-initiated SSO (unsolicited SAML responses) is disabled by default. Set saml.allowIdpInitiated: true to restore the previous behavior. This aligns with the SAML2Int interoperability profile which recommends against IdP-initiated SSO due to its susceptibility to injection attacks.extract.inResponseTo (always undefined) instead of samlify's actual path extract.response.inResponseTo. SP-initiated InResponseTo validation now works as intended in both ACS handlers.<AudienceRestriction> element. Audience is now validated against the configured samlConfig.audience value per SAML 2.0 Core §2.5.1.sessionIndex from login responses as { authnInstant, sessionNotOnOrAfter, sessionIndex }, but the code stored the whole object. SLO session-index comparisons always failed silently. The correct inner sessionIndex string is now extracted.validateInResponseTo() and validateAudience() into packages/sso/src/saml/response-validation.ts, eliminating ~160 lines of duplicated validation logic between the two ACS handlers.SAMLAssertionExtract type to match samlify's actual extractor output shape.For detailed changes, see CHANGELOG
@better-auth/oauth-providerprivate_key_jwt client authentication (RFC 7523) (#8836)For detailed changes, see CHANGELOG
authFor detailed changes, see CHANGELOG
Thanks to everyone who contributed to this release:
@bytaesu, @gustavovalverde, @Oluwatobi-Mustapha, @ramonclaudio
Full changelog: v1.6.2...v1.7.0-beta.0
Fetched May 1, 2026