Better Auth

BA

Better Auth

Join the community to ask questions about Better Auth and get answers from other members.

Join

bug-reports

help

Implementing Silent SSO/iFrame Authentication with Custom OIDC Provider in HonoJs/better-auth

I'm building a HonoJs API using better-auth. This API is consumed by a set of small, independent web components that are embedded on various external, top-level domains. The Challenge & Constraint: I cannot rely on traditional cross-site cookies for session management in the embedded web components....

After upgrading from 1.2.12 to 1.3.28, expo doesn't persists session in SecureStorage anymore.

So, i updated my dependencies (@better-auth/expo, better-auth) to 1.3.28 and now it doesn't persist the session anymore. I have a very simple authClient, see: ```typescript import { expoClient } from "@better-auth/expo/client"; import { createAuthClient } from "better-auth/react";...

INVALID_OAUTH_CONFIGURATION in Sveltekit

Hello, I have this configuration ```ts import { betterAuth } from 'better-auth'; import { drizzleAdapter } from 'better-auth/adapters/drizzle';...

Can we add extra field to user table?

In my MongoDB + PayloadCMS setup, Better Auth records ID, name, email, and email verification state. How can I add phone number to the saved fields?
Solution:
const { data, error } = await authClient.signUp.email({ email, password, name, phoneNumber,...

authClient.getSession to have fetchOptions for full Organization or Team data?

authClient.getSession, you get session and user object. session has activeOrganizationId and activeTeamId. Any plans to add a fetch Option to include organization or team data instead of making another network call?...

cli init TanStack Start support

Will the better-auth cli init command support TanStack Start?

Is this a good way to handle auth in hooks.server.ts?

```js import { building } from '$app/environment'; import { auth } from '$lib/server/auth'; import { redirect, type Handle } from '@sveltejs/kit'; import { svelteKitHandler } from 'better-auth/svelte-kit';...

SignIn "callbackURL" not functioning as expected.

Hello, I'm attempting to implement betterauth into my nextjs application and I'm hitting some bottlenecks. ```tsx...

How to use Cognito's identity_provider parameter?

I have better-auth configured in my Next.js app with Amazon Cognito and trying to send the user directly to Google sign in screen when clicking "Sign In" on my website. I would usually just add identity_provider=Google on Cognito's authorize URL. In NextAuth I found this. Is there a way to do that with better-auth?

Request resend verification email got 400 with Invalidation Error

I'm trying to resend verification email following the document guide in a Next.JS app: ```typescript export function ResendEmail({ locale, email }: { locale: Locale, email: string }) { const { t } = useTranslation(locale); const handleResendEmail = async () => {...

ExpressJS app crashes when deploying to Railway

``` /app/node_modules/.pnpm/better-auth@1.3.13/node_modules/better-auth/dist/crypto/index.cjs:315 undefined ^ Error [ERR_REQUIRE_ESM]: require() of ES Module /app/node_modules/.pnpm/@noble+ciphers@2.0.0/node_modules/@noble/ciphers/chacha.js from /app/node_modules/.pnpm/better-auth@1.3.13/node_modules/better-auth/dist/crypto/index.cjs not supported....

Prisma, BetterAuth: Model Verification does not exist.

```js import { betterAuth } from "better-auth" import { prismaAdapter } from "better-auth/adapters/prisma" import { reactStartCookies } from "better-auth/react-start" ...
Solution:
alright. I think @prisma/client wasnt updated for some reason, delete it and re-generated again. now fixed. dont know why npx prisma generate didnt update it as well
No description

Is there a way to verify the session cookie without calling the API?

I want to be able to verify if the session cookie is valid, and decode it, without having to call the API

Export createAdapterFactory doesn't exist in target module

I am integrating Better Auth with Convex in a NextJS 16 project. I followed this documentation step by step: https://www.better-auth.com/docs/integrations/convex#using-better-auth-from-the-server I am getting this issue: Error Type...
No description

Expression not callable

I remember using authClient.useSession() in other project last semester, but now, it keeps telling me its not callable anymore... how should I do it?
No description

`oidc_login_prompt` not clearing on successful login

I'm working with the OIDC plugin (in conjunction with the JWT plugin) to allow external applications to login through OAuth into my better-auth powered app, but I'm running into the problem outlined in: https://github.com/better-auth/better-auth/issues/5292 I added their lines and it somewhat worked, but the flow doesn't end up clearing out the cookie seeing as consent is already accepted. Any insight would be extremely helpful here...

Property 'id' does not exist in user on the twoFactor plugin in auth.ts file

Inside the "otpOptions" parameter in auth.ts file, it throws an error "Property id does not exist on type.", Where could I get the user ID that the code needs?

not able to get lastlogin method in my production

I have added last login method and its working fine in my local but returning null in production my sign in and sign up is working fine at both places but the last login method is coming as null i have checked the cookie and it was perfectly set in the cookie...

How to add custom fields in betterauth signup

Hi everyone! I’m working with BetterAuth and noticed that the signup form only provides a single name field by default. I’d like to customize it to have separate First Name and Last Name fields while using the provided files as a starting point. How can I add these custom fields to the signup form without breaking the existing functionality? Any guidance

Restrict discord login to members of specific server or role

outline.dev has this really nice feature, where you can restrict the sign up to only users that are a member of a discord specific server and have a specific role on that server. How could i implement something like that?