I am following the Add Login to Your Next.js Application instructions, and get stuck at step 4: Add the dynamic Route Handler as I keep getting the following error when testing route.js
:
throw new TypeError(error.details[0].message);
^
TypeError: "secret" is required
Here is my directory structure:
project_root_directory/.env.local
project_root_directory/src/pages/api/auth/[auth0]/route.js
)
I test it by adding:
console.log("the AUTH0_SECRET env var is set: ", !!process.env.AUTH0_SECRET);
which always returns:
the AUTH0_SECRET env var is set: false
Also, Next.js has two different routers: the App Router
and the Pages Router
, and we need to get this working with the Pages Router
. Is there a tutorial on how to achieve these instructions with the Pages Router
.
I would love some insights on what I am doing wrong.
Thank you!