K
Kinde3w ago
entropy

Error 500 with AuthProvider

Hi, I'm using Next.js 14/app router. When I wrap my app with the AuthProvider, I get a 500 error in the console. Is this expected? By the way, I'm also using withAuth with the Next.js middleware. Do I still need to wrap my app with the AuthProvider? Also, I noticed that most videos about Kinde never mention the AuthProvider component. XHRGET http://localhost:3000/api/auth/setup [HTTP/1.1 500 Internal Server Error 133ms]
9 Replies
CB_Kinde
CB_Kinde3w ago
Hey Entropy. Sorry you're getting this error? Who do you mean by auth provider? Are you referring to Google, GitHub, etc, as social sign up connections? Or enterprise connection like Entra ID?
Yoshify
Yoshify3w ago
I believe they mean the AuthProvider component provided by the NextJS SDK @CB_Kinde @entropy , I’ve personally never used it and encountered no issues with not using it. Not even Kindes own NextJS App Router Starter Kit uses it. I feel like it may be leftover from V1 of the App Router SDK but I’d need a team member to confirm. There shouldn’t be a problem with using it though, so it sounds like you may have a bug or configuration issue here. Does the app work for you without it? Do routes like api/auth/login or api/auth/health still work?
entropy
entropyOP3w ago
I mean the component mentioned in the Next.js App Router SDK Documentation. https://docs.kinde.com/developer-tools/sdks/backend/nextjs-sdk/ @Yoshify Yes, the app works without this component, but it’s clearly a part of the setup process according to the documentation.
Yoshify
Yoshify3w ago
I'll have to clarify with the team to get a solid answer on it. I'll get back to you.
entropy
entropyOP3w ago
Ok, I'm waiting for your answer
CB_Kinde
CB_Kinde3w ago
I've passed onto the team and they will respond when they can. Are you blocked?
entropy
entropyOP2w ago
Sorry, I completely missed your message. I still have this error, and I’m not really sure what to do with the component mentioned in the documentation. It doesn’t prevent my application from working, but I’d like to avoid potential issues in production later on.
CB_Kinde
CB_Kinde2w ago
Hi @entropy here is an initial answer from one of our devs. There is some discussion still continuing.
Its a great question - we've added it in to handle refreshing tokens on timer. Since Next.js doesn't allow setting cookies from a page.tsx it means that there are some cases where the token should be refreshed, but it can't be refreshed from server component pages. That's why we've put it into the docs 🙂 To help handle that case
Phil
Phil3d ago
Experiencing the same issue - 500s on /auth/setup
Want results from more Discord servers?
Add your server