Matt.welsonM
Convex Community2y ago
9 replies
Matt.welson

@convex-dev/auth isn't working with NextJs and Github provider

I had some trouble with my main project, so I started a small project with only the simplest login possible and it still won't work. When I follow the instructions in the doc I end up clicking the login button, approving on Github and then my page reloads, with no session created or anything.

convex/auth.ts
import { convexAuth } from "@convex-dev/auth/server";
import Github from "@auth/core/providers/github";

export const { auth, signIn, signOut, store } = convexAuth({
  providers: [Github],
});


src/app/page.ts
"use client";

import { useAuthActions } from "@convex-dev/auth/react";
import { Authenticated, AuthLoading, Unauthenticated } from "convex/react";

export default function Home() {
  const { signIn } = useAuthActions();

  return (
    <main className="flex min-h-screen flex-col items-center justify-between p-24">
      <AuthLoading>Loading...</AuthLoading>
      <Authenticated>Logged in</Authenticated>
      <Unauthenticated>
        Not logged in{" "}
        <button onClick={() => signIn("github")}>Log in with Github</button>
      </Unauthenticated>
    </main>
  );
}


My convex logs look like the attached image
image.png
Was this page helpful?