# initAuth0 config setup in App Router Next.js

**URL:** <https://community.auth0.com/t/initauth0-config-setup-in-app-router-next-js/151328>\
**Category:** Get Help\
**Tags:** configuration, application\
**Created:** [November 12, 2024, 6:35am UTC](https://community.auth0.com/t/initauth0-config-setup-in-app-router-next-js/151328 "2024-11-12T06:35:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![syketb](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@syketb](https://community.auth0.com/u/syketb)\
**Post date:** [November 12, 2024, 6:35am UTC](https://community.auth0.com/t/initauth0-config-setup-in-app-router-next-js/151328/1 "2024-11-12T06:35:47Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![marybeth.hunter](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/marybeth.hunter/32/61955_2.png) [@marybeth.hunter](https://community.auth0.com/u/marybeth.hunter)\
**Post date:** [November 12, 2024, 10:18pm UTC](https://community.auth0.com/t/initauth0-config-setup-in-app-router-next-js/151328/4 "2024-11-12T22:18:11Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![marybeth.hunter](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/marybeth.hunter/32/61955_2.png) [@marybeth.hunter](https://community.auth0.com/u/marybeth.hunter)\
**Post date:** [November 13, 2024, 3:27pm UTC](https://community.auth0.com/t/initauth0-config-setup-in-app-router-next-js/151328/5 "2024-11-13T15:27:57Z")

</div>

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](https://github.com/auth0-developer-hub/auth0-b2b-saas-starter/blob/main/app/api/auth/%5Bauth0%5D/route.ts)

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

Best,

Mary Beth

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [November 27, 2024, 3:28pm UTC](https://community.auth0.com/t/initauth0-config-setup-in-app-router-next-js/151328/6 "2024-11-27T15:28:05Z")

</div>

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