K
Kinde9mo ago
Torben

getting redirected even when not wanted

Problem started when I tried out to connect prisma to kinde. I set up the redirect_url and tested it but got Error: something went wrong with authentication null at GET (webpack-internal:///(rsc)/./src/app/api/auth/kinde_callback/route.ts:21:34) so I thought okay lets step back end try it without again but now I always get redirected to my kinde_callback endpoint even when I set this off in the env file. Please help!
4 Replies
Torben
TorbenOP9mo ago
This is my current env: ... KINDE_POST_LOGOUT_REDIRECT_URL=http://localhost:3000 KINDE_POST_LOGIN_REDIRECT_URL=http://localhost:3000/dashboard Tried everything removed it from everywhere forced it where i can but still. My assumtion is that the middleware is redirecting to the server which is redirecting on success to the kinde_callback endpoint. But then first I dont know why server should do this since its not set by me and second why is the server sending success and I only get null at my endpoint...
onderay
onderay9mo ago
I will get a team member who is more experienced with Prisma to help out on Monday. Regarding Redirection to kinde_callback Endpoint: If you're being redirected to the kinde_callback endpoint even after changing the environment variables, it's possible that the changes haven't been applied correctly or there's caching involved. It's also possible that the middleware or server configuration is hardcoded to redirect to this endpoint upon successful authentication. Have you looked this guide? https://kinde.com/blog/engineering/set-up-a-nextjs-app-with-prisma-orm-and-kinde-auth/
Kinde Blog
Set up a Next.js app with Prisma ORM and Kinde Auth
This guide provides detailed steps on how to seamlessly integrate Kinde, a robust authentication system, with Prisma ORM in a Next.js application.
Torben
TorbenOP9mo ago
Hey @Andre @ Kinde , I fixed it with the help of this guide haha. However, I must admit that it's less about the guide and more about a funny coincidence. The fix is that you should never use auth/kinde_callback for this, only for your own endpoints, for example the auth/success endpoint as shown in the guide. I initially thought it would work like a handshake, so I used the auth/kinde_callback endpoint because it makes more sence but its really a redirect. I believe it's acceptable to leave it that way if the kinde_callback is reserved, but it should be mentioned, perhaps in red, since I just overflowed the documentation and replicated the codes. I can't believe this fixed it - I spent nearly 2 hours on that, but really, guys, I love Kinde! You are amazing! It's a super bold product and perfect for startups!
onderay
onderay9mo ago
Great to hear that it's resolved now @Torben I will certainly pass your feedback over to the team to adjust the guide. And awesome to hear you are enjoying Kinde, we are always open to feedback to make it even better!
Want results from more Discord servers?
Add your server