initAuth0 config setup in App Router Next.js

I have a Next.js application with the App Router. I don’t want to use environment variables to add the Auth0 credentials. I found a way to use initAuth0, but it doesn’t work with the App Router. My goal is to load the credentials conditionally. Is it possible to do this with Auth0 in the App Router?

Hi @syketb!

Welcome to the Auth0 Community!

I have reached out to the SDK team regarding this question. I will let you know what I hear back!

Best,

Mary Beth

Hi @syketb,

I’ve heard back from a Solutions Engineer about this, and he recommended you take a look at the SaaStart repo. It’s using App Router.

Repo: auth0-b2b-saas-starter/app/api/auth/[auth0]/route.ts at main · auth0-developer-hub/auth0-b2b-saas-starter · GitHub

Please let me know if you have any additional questions after reviewing this repo!

Best,

Mary Beth