client side 404 for auth server #1355

Closed
opened 2026-03-13 08:34:38 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @sahilverma-dev on GitHub (Jun 15, 2025).

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

I have separate code for my client and server.

here's the client side config

import { env } from "@/env";
import { createAuthClient } from "better-auth/react";

export const authClient = createAuthClient({
  baseURL: "http://localhost:4000",
});

export const { signIn, signUp, useSession } = createAuthClient();

but client is making request for 3000
Image

Current vs. Expected behavior

I want to request to port 4000 but auth client is making request to 3000

Backend code is working as i tested it with postman.

Image

What version of Better Auth are you using?

^1.2.9

Provide environment information

- OS Mac
- Browser Arc

Which area(s) are affected? (Select all that apply)

Client

Auth config (if applicable)

import { env } from "@/env";
import { createAuthClient } from "better-auth/react";

export const authClient = createAuthClient({
  baseURL: "http://localhost:4000",
});

export const { signIn, signUp, useSession } = createAuthClient();

Additional context

No response

Originally created by @sahilverma-dev on GitHub (Jun 15, 2025). ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce I have separate code for my client and server. here's the client side config ```ts import { env } from "@/env"; import { createAuthClient } from "better-auth/react"; export const authClient = createAuthClient({ baseURL: "http://localhost:4000", }); export const { signIn, signUp, useSession } = createAuthClient(); ``` but client is making request for `3000` <img width="555" alt="Image" src="https://github.com/user-attachments/assets/dba2e6f9-e5c1-43f8-abe2-07e0b17010df" /> ### Current vs. Expected behavior I want to request to port `4000` but auth client is making request to `3000` Backend code is working as i tested it with postman. <img width="555" alt="Image" src="https://github.com/user-attachments/assets/63b821d7-c759-4616-a8e9-a252bbe12288" /> ### What version of Better Auth are you using? ^1.2.9 ### Provide environment information ```bash - OS Mac - Browser Arc ``` ### Which area(s) are affected? (Select all that apply) Client ### Auth config (if applicable) ```typescript import { env } from "@/env"; import { createAuthClient } from "better-auth/react"; export const authClient = createAuthClient({ baseURL: "http://localhost:4000", }); export const { signIn, signUp, useSession } = createAuthClient(); ``` ### Additional context _No response_
GiteaMirror added the bug label 2026-03-13 08:34:38 -05:00
Author
Owner

@iutx commented on GitHub (Jul 29, 2025):

Please tell me how to solve it, thank you!

@iutx commented on GitHub (Jul 29, 2025): Please tell me how to solve it, thank you!
Author
Owner

@sahilverma-dev commented on GitHub (Jul 29, 2025):

Please tell me how to solve it, thank you!
just use this

export const authClient = createAuthClient({
  baseURL: "http://localhost:4000",
});
@sahilverma-dev commented on GitHub (Jul 29, 2025): > Please tell me how to solve it, thank you! just use this ```ts export const authClient = createAuthClient({ baseURL: "http://localhost:4000", }); ```
Author
Owner

@marcbejar commented on GitHub (Aug 11, 2025):

I have set the baseURL to:
baseURL: "http://localhost:4000",

But better auth is ignoring it and using the NUXT frontend url (3001)

@marcbejar commented on GitHub (Aug 11, 2025): I have set the baseURL to: baseURL: "http://localhost:4000", But better auth is ignoring it and using the NUXT frontend url (3001)
Author
Owner

@sahilverma-dev commented on GitHub (Aug 11, 2025):

@marcbejar Share the code here. There might be some duplicate instance. Just like my case.

@sahilverma-dev commented on GitHub (Aug 11, 2025): @marcbejar Share the code here. There might be some duplicate instance. Just like my case.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#1355