I have just updated the Next.js SDK to version 3 due to its app router support. Immediately after that, it made pipelines fail, though I’ve added export const dynamic = "force-dynamic";
to the route handler files.
Here are the errors:
TypeError: "clientID" is required
TypeError: "secret" is required
And the route handlers:
import { handleAuth, handleLogin } from "@auth0/nextjs-auth0";
export const dynamic = "force-dynamic";
export const GET = handleAuth({
login: handleLogin({
authorizationParams: {
scope: "openid profile email offline_access",
},
}),
});
import { getAccessToken, withApiAuthRequired } from "@auth0/nextjs-auth0";
import { NextRequest, NextResponse } from "next/server";
export const dynamic = "force-dynamic";
async function accessToken(request: NextRequest) {
const response = new NextResponse();
// If your access token is expired, and you have a refresh token
// `getAccessToken` will fetch you a new one using the `refresh_token` grant
const accessToken = await getAccessToken(request, response);
return NextResponse.json(accessToken);
}
export const GET = withApiAuthRequired(accessToken);