Better Auth

BA

Better Auth

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

Join

bug-reports

help

Manual User SignUp

I'm only using google for signup . But suddenly my team asked me if we could manually signup user . Is there any way to do that? As google provides several data that are need for the user, account table and other 2 tables.

Get session call failing Safari

Hi, I’ve recently setup better auth with nextjs, using the drizzle adapter and nextCookie plugin. I wrote my own plugin for steam authentication (OpenID 2.0), which seems to be working good. However, one weird bug I’ve seen is that on safari, the get session call made when the user clicks my sites sign in button throws an error with status 0 and status text as an empty string. Any idea why this is happening? Thanks!...

How to get a bigger profile image from google and facebook?

I'm trying to get the image directly from oAuth2 and use it in my user's internal profile. However, I've been only getting a 50x50 image. Does anyone know if getting a higher res photo is possible?

How to seed initial admin user on develop/staging/prod to start creating users

I am having trouble creating this initial step for me to progress on, I am also looking into using both the admin and organization plugins to work hand in hand hows to make this possibel

Captcha verification failed

I keep getting "Captcha verification failed" after adding Cloudflare Turnstyle captcha using Nextjs: ```import { Footer } from "@/components/internal/footer"; import RegisterForm from "@/components/internal/forms/register-form"; import Navigation from "@/components/internal/navigation";...

Don't understand how to configure OIDC with an existing provider

I don't understand how to configure better-auth to connect to an exiting OIDC provider. I have an OIDC provider at my company. I wrote the following to register it in auth.js: ```javascript import { betterAuth } from "better-auth"; import { sso } from "better-auth/plugins/sso";...

How to Prevent Automatic Resending of Verification Email on Login with requireEmailVerification?

I have a question regarding the requireEmailVerification option. When I set requireEmailVerification: true, the backend correctly returns a 403 response if a non-verified user tries to log in. I handle this on the frontend by showing a verification modal. However, I’ve noticed that BetterAuth also automatically resends the verification email to the user when this happens. What I want:...

stripe subscription list 401

When I try to list the active subscriptions I get and 401 error. Tried using the doc example. Any idea? ```js...
Solution:
it suddenly worked after some restarts, i dont know how

Stripe customer portal "select certificate" alerts popping up multiple times

I'm wondering if anyone else has this issue during local development. When I call BA's cancel subscription function and redirect the user to stripe's customer portal I receive a lot of alerts asking me to select a certificate. Where does it come from?...

Extending the Organization plugin

I would like to add functionality to the organization plugin, is there a way to extend it? Or do I just add features to the original plugin? My idea is to use groups to, well, group users, where a user can join multiple groups and an org can have multiple groups, with a simple management API. Creating groups, deleting groups, updating groups / group members. These should not be used for permissions but simply for organization of users...

Notion OAuth in Remix

Hey! Has anyone managed to make Notion OAuth work in their better-auth config? I am trying to do it but I always get oauth_code_verification_failed on the client

How to invalidate the cookie cache after successful purchase via Polar?

Hello everyone, if some could please help me. I have auth already implemented and use additionalFields for the balance of the users, the problem is when the user buys more credits via Polar and gets redirected to the /success page in the Navbar where I display the balance I still see the cached value that comes from getSession but in the Databse I can see the updated value. I managed to remove the cookie with something like this: ```ts const removeCookie = createServerFn({ method: 'GET' }).handler(async () => { // invalidate better-auth.session_data cookie setCookie('better-auth.session_data', '', {...

sub domain cookies not working

I set my cross subdomain cookies based on the docs & put credentials: include on requests, but it still doesn't send the cookies to the API
No description

Invalid Email - Bad Request

I'm getting this error when doing a basic signup. Using SvelteKit. Auth Client: ```ts import { createAuthClient } from "better-auth/svelte"...
Solution:
Oh. I fixed it. My variables weren't labeled.
No description

Redirection after sign in

So I have better auth running on my express server. and better auth client on my Nextjs frontend. Express server is running on localhost:4000 and Nextjs on localhost:3000 The issue is after I initiate google login from NextJs (3000 port), the login is successful, however I get redirected to localhost:4000 as in the server URL. For example: ...
No description

Stripe free trial limit of one help

I haven't successfully found a way to limit the free trials for each customer. In my Svelte 5 app, a user's free 7-day trial starts when they first log in successfully, but when they pay for a subscription, the 7-day free trial starts again, and when they are returning customer after the first trial or after cancelling a subscription, the 7-day trial starts again. I've tried using the authorizeReference function but it hasn't worked.

got 403 in while list users

hello, i got error 403 like while doing list users from manager role, but when using admin role, its working headers is present btw using better-auth v.1.2.7...
Solution:
so i fixed it by created custom permissions like this ``` import { createAccessControl } from "better-auth/plugins/access"; import { adminAc, defaultStatements } from "better-auth/plugins/admin/access"; ...
No description

Better Auth Not Respecting OIDC Discovery Document Endpoints with IdentityServer4

Problem Description When implementing OAuth 2.0/OpenID Connect with IdentityServer4, Better Auth is not using the endpoints from the discovery document despite proper configuration. Instead, it's trying to use its own API structure (/api/auth/sign-in/oauth2). Current Implementation 1. Server Configuration (server.ts):...

Social signup for Expo App

Hello, i setup social signup on my backend and on my expo app now. This is my frontend code: let res = await authClient.signIn.social({ provider: "google", callbackURL: "/profile"...

Cookies amongst multiple tenants, subdomains, and custom domains for a SaaS

Hey folks, I'm working on what is ultimately Squarespace for a niche, where users will get a unique subdomain, and can also add their own custom domain (so we have mycoolapp.com where i'll be serving the marketing, john.mycoolapp.com, and maryscoolapp.com). Looking for guidance on how to get it working with BetterAuth; my stack is SvelteKit, with Postgres + Drizzle (using the direct Postgres connector, though), with Directus as the CMS for end users. Currently I'm having an issue where the cookies are being set on the TLD and not working on the subdomains. I'm aware that there's an organisation plugin, but that doesn't look to have anything specific to sharing cookies between sites....