Nextjs auth help

I was trying to authenticate my website but every api should use edge runtime and the authjs does not supported edge runtime until this time so is there any way I can attain it or even force certain api to use in the server instead of the edge runtime
1 Reply
Yatsuki
Yatsuki11mo ago
the next nextauth will u can still the experimental branch of nextauth but it's very buggy npm i next-auth@experimental
const authOptions: NextAuthConfig = {
providers: [
Google({
clientId: process.env.GOOGLE_CLIENT_ID,
clientSecret: process.env.GOOGLE_CLIENT_SECRET,
}) as Provider,
],
secret: process.env.GOOGLE_CLIENT_SECRET,
pages: {
signIn: "/signin",
},
};

const handler = NextAuth(authOptions);
export const GET = handler.handlers.GET;
export const POST = handler.handlers.POST;

export const runtime = "edge";
const authOptions: NextAuthConfig = {
providers: [
Google({
clientId: process.env.GOOGLE_CLIENT_ID,
clientSecret: process.env.GOOGLE_CLIENT_SECRET,
}) as Provider,
],
secret: process.env.GOOGLE_CLIENT_SECRET,
pages: {
signIn: "/signin",
},
};

const handler = NextAuth(authOptions);
export const GET = handler.handlers.GET;
export const POST = handler.handlers.POST;

export const runtime = "edge";
Want results from more Discord servers?
Add your server
More Posts