disableSignUp not working with Google as social provider #1112

Closed
opened 2026-03-13 08:23:07 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @Jornve on GitHub (Apr 25, 2025).

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

  1. add disableSignUp to google object
  2. try to login with not used google account

Current vs. Expected behavior

I should not be able to login and get error message but I receive a session and am redirect to my dashboard (only accessible for authenticated users)

What version of Better Auth are you using?

1.2.4

Provide environment information

n/a

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

Backend, Client

Auth config (if applicable)

export const auth = betterAuth({
  secret: String(process.env.BETTER_AUTH_SECRET),
  database: prismaAdapter(prisma, {
    provider: "postgresql",
  }),
  emailAndPassword: {
    enabled: true,
    requireEmailVerification: true,
    sendResetPassword: async ({user, url}, request) => {
      await sendPasswordResetEmail(user.email, url, user.name)
    },
  },
  emailVerification: {
    sendVerificationEmail: async ({user, url}, request) => {
      const newUrl = new URL(url);
      newUrl.searchParams.set('callbackURL', '/login&verified=true');
      await sendEmailVerificationEmail(user.email, user.name, newUrl.toString())
    }
  },
  socialProviders: {
    google: {
      clientId: String(process.env.GOOGLE_CLIENT_ID!),
      clientSecret: String(process.env.GOOGLE_CLIENT_SECRET!),
      disableSignUp: true,
    }
  },
  advanced: {
    cookiePrefix: "sys"
  },
  plugins: [nextCookies()] // make sure nextCookies() is the last plugin in the array
})

Additional context

No response

Originally created by @Jornve on GitHub (Apr 25, 2025). ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce 1. add disableSignUp to google object 2. try to login with not used google account ### Current vs. Expected behavior I should not be able to login and get error message but I receive a session and am redirect to my dashboard (only accessible for authenticated users) ### What version of Better Auth are you using? 1.2.4 ### Provide environment information ```bash n/a ``` ### Which area(s) are affected? (Select all that apply) Backend, Client ### Auth config (if applicable) ```typescript export const auth = betterAuth({ secret: String(process.env.BETTER_AUTH_SECRET), database: prismaAdapter(prisma, { provider: "postgresql", }), emailAndPassword: { enabled: true, requireEmailVerification: true, sendResetPassword: async ({user, url}, request) => { await sendPasswordResetEmail(user.email, url, user.name) }, }, emailVerification: { sendVerificationEmail: async ({user, url}, request) => { const newUrl = new URL(url); newUrl.searchParams.set('callbackURL', '/login&verified=true'); await sendEmailVerificationEmail(user.email, user.name, newUrl.toString()) } }, socialProviders: { google: { clientId: String(process.env.GOOGLE_CLIENT_ID!), clientSecret: String(process.env.GOOGLE_CLIENT_SECRET!), disableSignUp: true, } }, advanced: { cookiePrefix: "sys" }, plugins: [nextCookies()] // make sure nextCookies() is the last plugin in the array }) ``` ### Additional context _No response_
Author
Owner

@Kinfe123 commented on GitHub (Apr 25, 2025):

Did the user sign up before the flag was set to true?

@Kinfe123 commented on GitHub (Apr 25, 2025): Did the user sign up before the flag was set to true?
Author
Owner

@Jornve commented on GitHub (Apr 25, 2025):

Did the user sign up before the flag was set to true?

No but I just upgraded to the latest version of better-auth and it is working now. Also noticed the bug being fixed in release 1.2.5.

Going to close this issue.

@Jornve commented on GitHub (Apr 25, 2025): > Did the user sign up before the flag was set to true? No but I just upgraded to the latest version of better-auth and it is working now. Also noticed the bug being fixed in release 1.2.5. Going to close this issue.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#1112