#NextAuth Google Provider

6 messages · Page 1 of 1 (latest)

indigo steppe
#

Full auth config:

export const options = {
  providers: [
    GoogleProvider({
      clientId: process.env.GOOGLE_CLIENT_ID as string,
      clientSecret: process.env.GOOGLE_CLIENT_SECRET as string,
    }),
  ],
  secret: process.env.NEXTAUTH_SECRET as string,
};

And then the auth route:

import NextAuth from "next-auth";

import { options } from "@/src/lib/nextauth";

const handler = NextAuth(options);

export { handler as GET, handler as POST };

And finally, using the default middleware:

export { default } from "next-auth/middleware";

Logs show no errors... It redirects when I click on "Log in with Google" and redirects back to the login page - with __Secure-next-auth.session-token cookie...

It's an internal app (Google) and hosted on Netlify.

devout geodeBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

tacit helm
#

Your description sounds like it works. What is the issue?

indigo steppe
#

It returns back the cookie and shows in logs that I am authenticated. However, it wont let me leave the signin page.

rigid flint
#

I recommend using clerk for auth, makes life easier

#

are you follwing a guide also? should be copy pasted code