[Better Auth]: Couldn't read your auth config. Error: Cannot find module '$app/paths'
Has anyone else had this issue (see title) when running the
npx @better-auth/cli generate
cli command on SvelteKit? I can't figure out how to fix this issue.Solution:
Duki, as mentioned by @KiNFiSH you probably need to remove any import that is called using sveltekit conventions and the run it. that's what I had to do
Tanstack Start how to handle session cookie
First the stack, im using Tanstack Start, Hono and Better-Auth
The issue is when I hard reload or enter the URL manually, the cookie will not be read..
If its by client navigation it works correctly...
...
social signUp flow
I want to enable my users to sign up with Apple. I have additional required fields on the
user
model:
```
user: {
additionalFields: {
surname: {...Manage Customer Portal
How can I manage the customer portal? When I do it via
authClient.subscription.cancel({
returnUrl: "/dashboard",
});
...
Anyone using auth.api in a server action with useActionState?
I'm having trouble getting the session to update, have followed the docs to use the
nextCookies()
plugin but the example server action doesn't return anything so I'm not really sure how that's meant to work.
Maybe I'm holding it wrong, but my current setup is using a server action with useActionState
on my sign in form so that I can display errors.
The server action calls auth.api.signInEmail
and redirects on success, or returns errors to the action state for me to display in the form....Authenticated request with Expo
Hi everyone! I successfully integrated better-auth with expo and expressjs (email&password plugin). Now, i need to make authenticated request to my backend. How can I make that?
I tried using using authClient:
```typescript
export const authClient = createAuthClient({...

golang backend with nextjs cookie check.
I have created better auth server in my nextjs client app and want to integrate with a golang api service, but i don't know how to extract the cookie in my middleware, how to extract data from a cookie. I have tried jwt plugin as an alternate solution but still can't figure out how to extract the data correctly.
I need to use cookie if possible....
Social Sign-in Invited Emails Only
Hi guys, i am working on a project where the signups are disabled and allowed only to the invited emails. for email password signups i have implemented it with hooks, but the issue coming is with social providers. i have listened to the context in after hooks. and throwing the error in case unauthorized with apierror and its fine but on server's endpoint and when i used ctx.redirect with throw or even return it doesnt work and let the user go through.
this is my hooks config for both email/password and social provider:
hooks: {...

I think there is some type error
It does work fine but it show type error of Image being not present in signUpEmail through server API. Before the last update it used to work fine
Solution:
Type errors are present in any version above 1.2.5, Latest safe version to work with right now is 1.2.5 (based on my opinion)

Additional fields missing from User type
I have added 2 additional fields to better auth with this code:
```typescript
export const auth = betterAuth({
appName: 'Test',
user: {...
How to refresh JWT manually
I understand that the JWT may expire before the session expires. In this case, I check whether the JWT is expired before I issue a new JWT.
I've tried this method so far but no avail:
- getting the session using the expired jwt so I can call
api.getToken
by placing the session token but no avail as calling getSession only returns null
...[OIDC] `offline_access` invalid scope
Using BA OIDC plugin, from an OIDC RP (Auth.js on Next.js app) I am requesting the
offline_access
scope but get GET /api/auth/oauth2/authorize?error=invalid_scope&error_description=The%20following%20scopes%20are%20invalid:%20offline_access 302 in 26ms
BA OIDC plugin docs say that offline_access
is in the default scopes
array (openid profile email offline_access
). Am I missing a BA config option, or is it an issue on the RP side?...Issue with sign up using express
Hi,
I have been running in to an issue where my express server returns 422 Unprocessable Entity any time the client sends a sign up request. I have included my prisma schema, better auth config and my index.ts file (I have pretty much copied exactly whats on the better auth docs).
Looking at the incoming requests on the express server, I can see the sign up requests come through however I noticed that the request body was undefined. Looking at the actual request through the network I can see that body is included in the post request. I have no issues adding data to the db manually through psql. Any ideas on what is causing this issue? ...
Auth service in microservice architecture
I'm trying to build a Hono backend setup with two separate services:
One serves as the auth server that handles all user-related logic (base path: /auth), and the other handles business logic (base path: /api).
In production, both will be hosted on the same domain. Locally, I'm using localhost:3000 for the business logic and localhost:3001 for auth.
Currently, I’m able to log in with Google OAuth via the auth server from the frontend but when I try to fetch data from the API backend, the session is null, which results in a 401 error.
...
Reset Password
im on making a reset password with temporary password flow
But dont know where to put this function in order to set user password
const token = new URLSearchParams(window.location.search).get("token");...

Posthog identify after sign up
Hi all, I'm using posthog for analytics in my next js app and planning to make use of the identify feature (https://posthog.com/docs/product-analytics/identify). I use the email and password flow with email verification from better auth. It's pretty easy to set it up when a user logs in as I can use the "onSuccess" callback. However, I can't wrap my head around how to do it after a successful sign up. I know you have a hooks.after callback but it runs on the server side and posthog needs to call identify on the client side. Could you suggest what the best way to do it? Thank you?
Here's my auth.ts
```
export const auth = betterAuth({...
Solution:
Hi, maybe try after hook in database. I use it to send a wellcome mail to the user after he sign up.
https://www.better-auth.com/docs/concepts/database#database-hooks...
Avatar Upload Issue: Session Cookie Size and Upload Timing
We're facing a challenge with our avatar upload implementation:
Problem: When a user uploads an avatar during signup, the base64-encoded image is stored in the session cookie, making it too large and causing the app to crash
Potential solution: We need to disable cache for the Session cookie
...
Solution:
you can use before hook or upload the image prior to calling signUp and then pass the image link instead of base64 to better auth.
magic link sendMagicLink using astro request is undefined
Hi guys, Iam stuck for a while now. I dont understand when or why the Request is undefined. Email, token and url are getting printed but the request is always empty. ```ts
plugins: [
magicLink({
sendMagicLink: async ({ email, token, url }, request) => {
// send email to user...