[GH-ISSUE #312] Github login zod error #25537

Closed
opened 2026-04-17 15:48:12 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @koohz on GitHub (Oct 23, 2024).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/312

Describe the bug
Trying to login with github provider give a "please_restart_the_process" error. Github portal have the redirect url pointing to:
http://localhost:3000/api/auth/callback/github
The other login providers works well.

Screenshot 2024-10-23 193121

Screenshot 2024-10-23 193114

To Reproduce
Steps to reproduce the behavior:

All steps described in better-auth docs

Expected behavior
Should login like as other social provider do

import { authClient } from "@/lib/auth-client";

/*
* .....
*/

<Button
  variant="outline"
  className="w-full"
  onClick={() => {
    authClient.signIn.social({
      provider: "github",
    });
  }}
>Login with Github</Button>
import { betterAuth } from "better-auth";
import { prismaAdapter } from "better-auth/adapters/prisma";
import { db } from "@/server/db";
import { env } from "@/env";


export const auth = betterAuth({
  emailAndPassword: {
    enabled: true,
  },
  socialProviders: {
    discord: {
      clientId: env.DISCORD_CLIENT_ID,
      clientSecret: env.DISCORD_CLIENT_SECRET,
    },
    github: {
      clientId: env.GITHUB_CLIENT_ID,
      clientSecret: env.GITHUB_CLIENT_SECRET,
    },
    google: {
      clientId: env.GOOGLE_CLIENT_ID,
      clientSecret: env.GOOGLE_CLIENT_SECRET,
    },
  },
  database: prismaAdapter(db, {
    provider: "postgresql", // or "mysql", "postgresql", ...etc
  }),
  logger : {
    disabled : false,
    verboseLogging : true
  }
});
Originally created by @koohz on GitHub (Oct 23, 2024). Original GitHub issue: https://github.com/better-auth/better-auth/issues/312 **Describe the bug** Trying to login with github provider give a "please_restart_the_process" error. Github portal have the redirect url pointing to: **http://localhost:3000/api/auth/callback/github** The other login providers works well. ![Screenshot 2024-10-23 193121](https://github.com/user-attachments/assets/a392d4c6-b281-44d0-aa6e-1314dde3ac88) ![Screenshot 2024-10-23 193114](https://github.com/user-attachments/assets/5a7c589c-9123-4e02-8a55-9ca172dab488) **To Reproduce** Steps to reproduce the behavior: All steps described in better-auth docs **Expected behavior** Should login like as other social provider do ```typescript import { authClient } from "@/lib/auth-client"; /* * ..... */ <Button variant="outline" className="w-full" onClick={() => { authClient.signIn.social({ provider: "github", }); }} >Login with Github</Button> ``` ```typescript import { betterAuth } from "better-auth"; import { prismaAdapter } from "better-auth/adapters/prisma"; import { db } from "@/server/db"; import { env } from "@/env"; export const auth = betterAuth({ emailAndPassword: { enabled: true, }, socialProviders: { discord: { clientId: env.DISCORD_CLIENT_ID, clientSecret: env.DISCORD_CLIENT_SECRET, }, github: { clientId: env.GITHUB_CLIENT_ID, clientSecret: env.GITHUB_CLIENT_SECRET, }, google: { clientId: env.GOOGLE_CLIENT_ID, clientSecret: env.GOOGLE_CLIENT_SECRET, }, }, database: prismaAdapter(db, { provider: "postgresql", // or "mysql", "postgresql", ...etc }), logger : { disabled : false, verboseLogging : true } }); ```
GiteaMirror added the locked label 2026-04-17 15:48:12 -05:00
Author
Owner

@himself65 commented on GitHub (Oct 30, 2024):

how do you fix this?

<!-- gh-comment-id:2445601621 --> @himself65 commented on GitHub (Oct 30, 2024): how do you fix this?
Author
Owner

@koohz commented on GitHub (Oct 30, 2024):

Check all URL in your github OAuth application

<!-- gh-comment-id:2446539479 --> @koohz commented on GitHub (Oct 30, 2024): Check all URL in your github OAuth application
Author
Owner

@dvalbuena1 commented on GitHub (Nov 9, 2024):

For anyone using GitHub Apps instead of OAuth Apps. To fix it you need to add the "Email addresses" access under "Account permissions" section.

<!-- gh-comment-id:2466008099 --> @dvalbuena1 commented on GitHub (Nov 9, 2024): For anyone using GitHub Apps instead of OAuth Apps. To fix it you need to add the "Email addresses" access under "Account permissions" section.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#25537