NextAuth Google Provider
Unanswered
Sloth bear posted this in #help-forum
Sloth bearOP
Full auth config:
And then the auth route:
And finally, using the default 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.
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.
5 Replies
Asian black bear
Your description sounds like it works. What is the issue?
Sloth bearOP
It returns back the cookie and shows in logs that I am authenticated. However, it wont let me leave the signin page.
Barbary Lion
I recommend using clerk for auth, makes life easier
are you follwing a guide also? should be copy pasted code
Asian black bear
Clerk is amazing, and I highly reccomend it as well. NextAuth is a pain.