npm better-auth 1.7.29
v1.7.29

29 minutes ago

Important

Action required

  • If you have plugins or code that use the result of updateVerificationByIdentifier, handle null, which means a hook blocked the update or the value is gone. (#12975)
  • If you have plugins or code that use the result of createVerificationValue, handle null before reading fields such as identifier. (#12958)

better-auth

Bug Fixes

  • Fixed email OTP and phone number codes resent during a wrong-guess check to no longer be replaced by the old code when verification uses only secondary storage (#12956)
  • Fixed two-factor OTP codes that were resent during a wrong-guess check being rejected in favor of the old code (#12956)
  • Fixed secondary storage failures to be logged and rethrown without the session tokens and cached sessions they were called with (#12969)
  • Fixed email OTP resends with resendStrategy: "reuse" to send a new code instead of repeating one that was already used or removed (#12975)
  • Fixed email OTP and phone number OTP to stop sending a code when a verification.update.before hook blocks it from replacing an earlier code (#12975)
  • Fixed update.after database hooks to skip updates that match no record instead of running with null (#12975)
  • Fixed verification.update database hooks to run when verification values are kept in secondary storage (#12975)
  • Fixed email OTP and phone number OTP to stop sending codes that a verification.create.before hook kept from being stored (#12958)
  • Fixed magic link, password reset, account deletion, one-time token, SIWE nonce, and two-factor flows to stop handing out links, codes, or tokens that a verification.create.before hook kept from being stored (#12958)
  • Fixed sign-up failing or storing a wrong value when the request includes an input: false field with a function defaultValue (#12959)
  • Fixed oneTap({ disableSignUp: true }) being ignored so /one-tap/callback no longer creates new users when sign-up is disabled (#12962)
  • Fixed organization dynamic role names to be trimmed and to reject empty names or names containing a comma with INVALID_ROLE_NAME (#12952)
  • Fixed two-factor enable, disable and enrollment to keep the original session creation time when replacing the session, so session.freshAge is respected (#12955)

For detailed changes, see CHANGELOG

@better-auth/core

Bug Fixes

  • Fixed secondary storage failures to be logged and rethrown without the session tokens and cached sessions they were called with (#12969)
  • Changed InternalAdapter.updateVerificationByIdentifier to be typed as returning Promise<Verification | null>, resolving to null when a hook blocks the update or nothing is stored (#12975)
  • Changed InternalAdapter.createVerificationValue to be typed as returning Promise<Verification | null>, matching its existing null result when a hook returns false (#12958)
  • Fixed after-commit hooks to log later failures while still throwing the first when multiple hooks fail and no onAfterCommitHookError handler is set (#12953)
  • Fixed after-commit hooks failing with TypeError: hook is not a function when an app loads more than one copy of @better-auth/core (#12953)
  • Fixed database errors with a non-unique driver code to no longer be mistaken for unique violations because of their message text (#12957)

For detailed changes, see CHANGELOG

@better-auth/oauth-provider

Bug Fixes

  • Fixed the OAuth provider authorization endpoint to redirect with error=server_error instead of an unusable code when a verification.create.before hook blocks storing it (#12958)
  • Fixed OAuth provider resource admin endpoints returning a 500 with the Drizzle adapter when a resource or client-resource link already exists (#12951)

For detailed changes, see CHANGELOG

@better-auth/api-key

Bug Fixes

  • Fixed API key plugin customStorage failures to be logged and rethrown without the keys and values they were called with (#12969)

For detailed changes, see CHANGELOG

@better-auth/electron

Bug Fixes

  • Fixed Electron sign-in transfer to fail with FAILED_TO_CREATE_VERIFICATION instead of returning an authorization code when a verification.create.before hook blocks storing it (#12958)

For detailed changes, see CHANGELOG

@better-auth/passkey

Bug Fixes

  • Fixed passkey registration and authentication to fail with FAILED_TO_CREATE_VERIFICATION instead of returning a challenge when a verification.create.before hook blocks storing it (#12958)

For detailed changes, see CHANGELOG

@better-auth/sso

Bug Fixes

  • Fixed SSO to fail with FAILED_TO_CREATE_VERIFICATION instead of returning a domain verification token or SAML redirect when a verification.create.before hook blocks storing the record (#12958)

For detailed changes, see CHANGELOG

auth

Bug Fixes

  • Fixed auth generate to give missing Prisma back-relations the same @relation name as their foreign-key side, and to error when it cannot add a valid one (#12954)

For detailed changes, see CHANGELOG

Contributors

Thanks to everyone who contributed to this release:

@bytaesu, @gustavovalverde, @seifsheikhelarab

Full changelog: v1.7.28...v1.7.29

Don't miss a new better-auth release

NewReleases is sending notifications on new releases.