TypeError: "secret" is required

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

I would love some insights on what I am doing wrong.

Thank you!

PS I tried to add links and got the following message :frowning: :
“An error occurred: Sorry, new users can’t put links in posts.”

This issue seems to be related to this Auth0 guide: Auth0 Next.js SDK Quickstarts: Add Login to your Next.js application

I recommend reaching out to the Auth0 community at https://community.auth0.com/ for help with this issue.

1 Like

Got it! Thank you @piyusha !

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.