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.