Email signup has a callback url #1164

Closed
opened 2026-03-13 08:25:59 -05:00 by GiteaMirror · 10 comments
Owner

Originally created by @gyanendrasng on GitHub (May 5, 2025).

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

on betterauth react, signUp.email has an callback url which doesn't do anything

Current vs. Expected behavior

Either it should callback and added in docs, or be removed

What version of Better Auth are you using?

1.2.7

Provide environment information

MacOs

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

Client

Auth config (if applicable)

await signUp.email({
                email: values.email as string,
                password: values.password as string,
                callbackURL: ROUTES.DASHBOARD,
                name: values.fullName as string,
              });

Additional context

No response

Originally created by @gyanendrasng on GitHub (May 5, 2025). ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce on betterauth react, signUp.email has an callback url which doesn't do anything ### Current vs. Expected behavior Either it should callback and added in docs, or be removed ### What version of Better Auth are you using? 1.2.7 ### Provide environment information ```bash MacOs ``` ### Which area(s) are affected? (Select all that apply) Client ### Auth config (if applicable) ```typescript await signUp.email({ email: values.email as string, password: values.password as string, callbackURL: ROUTES.DASHBOARD, name: values.fullName as string, }); ``` ### Additional context _No response_
Author
Owner

@TerryHenrard commented on GitHub (May 23, 2025):

I noticed the same, I don't know how to upvote, so I leave a comment ;)

@TerryHenrard commented on GitHub (May 23, 2025): I noticed the same, I don't know how to upvote, so I leave a comment ;)
Author
Owner

@itsmejawad commented on GitHub (May 29, 2025):

Same issue.

authClient.signUp.email(
      {
        email: values.email,
        password: values.password,
        name: values.name,
        callbackURL: "/auth/login", // Should redirect to /auth/login, however, account is created successfully without redirection. 
      }
    );
  • authClient.signIn.email() is working just fine.

Did you figure out a solution? I don't want to use the router.

@itsmejawad commented on GitHub (May 29, 2025): Same issue. ``` authClient.signUp.email( { email: values.email, password: values.password, name: values.name, callbackURL: "/auth/login", // Should redirect to /auth/login, however, account is created successfully without redirection. } ); ``` - authClient.signIn.email() is working just fine. Did you figure out a solution? I don't want to use the router.
Author
Owner

@TerryHenrard commented on GitHub (May 29, 2025):

Personally, I used the NextJS router hook.

import { useRouter } from 'next/navigation';
const router = useRouter();
router.push('/dashboard');
@TerryHenrard commented on GitHub (May 29, 2025): Personally, I used the NextJS router hook. ```js import { useRouter } from 'next/navigation'; const router = useRouter(); router.push('/dashboard'); ```
Author
Owner

@itsmejawad commented on GitHub (May 29, 2025):

Personally, I used the NextJS router hook.

import { useRouter } from 'next/navigation';
const router = useRouter();
router.push('/dashboard');

I will use that for now and check later if there is a fix.

@itsmejawad commented on GitHub (May 29, 2025): > Personally, I used the NextJS router hook. > > import { useRouter } from 'next/navigation'; > const router = useRouter(); > router.push('/dashboard'); I will use that for now and check later if there is a fix.
Author
Owner

@TheAlexGo commented on GitHub (Jun 7, 2025):

+1, guys =)

@TheAlexGo commented on GitHub (Jun 7, 2025): +1, guys =)
Author
Owner

@TonybynMp4 commented on GitHub (Jun 11, 2025):

Sounds crazy but it seems none of you use email verification?
According to the docs on signing up with email & password callback URL is used after the user VERIFIES their email, not directly after signup! That's why it's marked as optional, though (globally) adding precision to when optionnal props can be used would be nice for sure!
Hope this helps :)

@TonybynMp4 commented on GitHub (Jun 11, 2025): Sounds crazy but it seems none of you use email verification? According to the docs on [signing up with email & password](https://www.better-auth.com/docs/authentication/email-password#sign-up) callback URL is used after the user VERIFIES their email, not directly after signup! That's why it's marked as optional, though (globally) adding precision to when optionnal props can be used would be nice for sure! Hope this helps :)
Author
Owner

@TerryHenrard commented on GitHub (Jun 11, 2025):

I just tried it for fun, I'm not using it for my projects yet. But thanks, it's probably where the problem is.

@TerryHenrard commented on GitHub (Jun 11, 2025): I just tried it for fun, I'm not using it for my projects yet. But thanks, it's probably where the problem is.
Author
Owner

@emersonlaurentino commented on GitHub (Jun 22, 2025):

I've the same issue 😕

@emersonlaurentino commented on GitHub (Jun 22, 2025): I've the same issue 😕
Author
Owner

@ping-maxwell commented on GitHub (Jul 10, 2025):

Hey guys, just like what @TonybynMp4 says, this is for email verification purposes.
Arguably the property name can be better 🤔

We still recommend redirecting using your own code logic.
I'll close this for now, if you have any questions regarding this issue I'll happily re-open it!

@ping-maxwell commented on GitHub (Jul 10, 2025): Hey guys, just like what @TonybynMp4 says, this is for email verification purposes. Arguably the property name can be better 🤔 We still recommend redirecting using your own code logic. I'll close this for now, if you have any questions regarding this issue I'll happily re-open it!
Author
Owner

@jessethomson commented on GitHub (Oct 9, 2025):

This still seems like a bug or at least inconsistent behavior.

The issue is that signUp does not redirect to the provided callbackURL, while signIn does, even when the user’s email is not yet verified.

In other words, if a new user signs up, there’s no redirect because their email isn’t verified. But if that same unverified user navigates to /login and signs in, the redirect works as expected.

I would expect consistent behavior between signUp and signIn, doing something like:

  • Option 1: Both signIn and signUp always redirect to callbackURL, regardless of email verification status.
  • Option 2: Both redirect only if requireEmailVerification is false; neither redirect if it’s true.

My preference would be Option 1, since it seems to follow the principle of least surprise (if I set a callbackURL, it gets used).

As far as use cases for allowing redirecting before email verification, some apps allow users to access the app before email verification, with verification required only for certain features (like joining an organization) or after a period of time. In those cases, blocking redirects after sign-up feels unnecessarily restrictive and confusing.

@jessethomson commented on GitHub (Oct 9, 2025): This still seems like a bug or at least inconsistent behavior. The issue is that `signUp` does **not** redirect to the provided `callbackURL`, while `signIn` does, even when the user’s email is not yet verified. In other words, if a new user signs up, there’s no redirect because their email isn’t verified. But if that same unverified user navigates to `/login` and signs in, the redirect works as expected. I would expect consistent behavior between `signUp` and `signIn`, doing something like: - **Option 1**: Both `signIn` and `signUp` always redirect to `callbackURL`, regardless of email verification status. - **Option 2**: Both redirect only if `requireEmailVerification` is `false`; neither redirect if it’s `true`. My preference would be **Option 1**, since it seems to follow the principle of least surprise (if I set a callbackURL, it gets used). As far as use cases for allowing redirecting before email verification, some apps allow users to access the app before email verification, with verification required only for certain features (like joining an organization) or after a period of time. In those cases, blocking redirects after sign-up feels unnecessarily restrictive and confusing.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#1164