Sign in with GitHub not working.
I'm using better auth with TanStack Start, when click on "Continue with GitHub", a request is sent but it keeps pending (check attached screenshot).
I have this component;
This is my auth instance:
Auth client:
Endpoint:
I have this component;
import { authClient } from "~/lib/auth-client";
import { SiGithub } from "react-icons/si";
import { Button } from "~/components/ui/button";
const ContinueWithGitHub = () => {
const signIn = async () => {
await authClient.signIn.social({
provider: "github",
});
};
return (
<Button
className="flex items-start gap-x-2 px-10 py-3 text-base bg-background text-foreground"
onClick={signIn}
>
<SiGithub size={20} /> Continue with GitHub
</Button>
);
};
export default ContinueWithGitHub;import { authClient } from "~/lib/auth-client";
import { SiGithub } from "react-icons/si";
import { Button } from "~/components/ui/button";
const ContinueWithGitHub = () => {
const signIn = async () => {
await authClient.signIn.social({
provider: "github",
});
};
return (
<Button
className="flex items-start gap-x-2 px-10 py-3 text-base bg-background text-foreground"
onClick={signIn}
>
<SiGithub size={20} /> Continue with GitHub
</Button>
);
};
export default ContinueWithGitHub;This is my auth instance:
import { betterAuth } from "better-auth";
import { drizzleAdapter } from "better-auth/adapters/drizzle";
import * as authSchema from "../../auth-schema";
import { db } from "~/db";
export const auth = betterAuth({
database: drizzleAdapter(db, {
provider: "pg",
schema: authSchema,
}),
socialProviders: {
github: {
clientId: process.env.GITHUB_CLIENT_ID!,
clientSecret: process.env.GITHUB_CLIENT_SECRET!,
},
},
});import { betterAuth } from "better-auth";
import { drizzleAdapter } from "better-auth/adapters/drizzle";
import * as authSchema from "../../auth-schema";
import { db } from "~/db";
export const auth = betterAuth({
database: drizzleAdapter(db, {
provider: "pg",
schema: authSchema,
}),
socialProviders: {
github: {
clientId: process.env.GITHUB_CLIENT_ID!,
clientSecret: process.env.GITHUB_CLIENT_SECRET!,
},
},
});Auth client:
import { createAuthClient } from "better-auth/react";
export const authClient = createAuthClient({
baseURL: "http://localhost:3000",
});import { createAuthClient } from "better-auth/react";
export const authClient = createAuthClient({
baseURL: "http://localhost:3000",
});Endpoint:
import { auth } from "~/lib/auth";
import { createAPIFileRoute } from "@tanstack/start/api";
export const APIRoute = createAPIFileRoute("/api/auth/$")({
GET: ({ request }) => {
return auth.handler(request);
},
POST: ({ request }) => {
return auth.handler(request);
},
});import { auth } from "~/lib/auth";
import { createAPIFileRoute } from "@tanstack/start/api";
export const APIRoute = createAPIFileRoute("/api/auth/$")({
GET: ({ request }) => {
return auth.handler(request);
},
POST: ({ request }) => {
return auth.handler(request);
},
});