kinde-oss / kinde-auth-nextjs

Kinde NextJS SDK - authentication for server rendered apps
https://kinde.com/docs/developer-tools/nextjs-sdk/
MIT License
132 stars 17 forks source link

Getting 500 response after login redirect #174

Closed kingRayhan closed 1 month ago

kingRayhan commented 1 month ago

Prerequisites

Describe the issue

I am getting 500 error during redirect to /api/auth/kinde_callback

CleanShot 2024-05-28 at 11  36 19@2x

CleanShot 2024-05-28 at 11  37 17@2x

Library URL

https://github.com/kinde-oss/kinde-auth-react

Library version

^2.2.11

Operating system(s)

macOS

Operating system version(s)

14.5 (23F79)

Further environment details

No response

Reproducible test case URL

https://github.com/kingRayhan/kinde-play

Additional information

No response

DanielRivers commented 1 month ago

Hi @kingRayhan

Thanks for a great reproduction link

This is because you have defined a non absolute URL here

<LoginLink postLoginRedirectURL="/">Login</LoginLink>

What would expect to happen here?

kingRayhan commented 1 month ago

@DanielRivers thanks for your quick response, I was expecting to redirect to / aka the home page after login.

DanielRivers commented 1 month ago

I agree this would be ideal.

I will raise a change now which will detect relative and absolute and attach host if relative.

I believe this would work in your case?

kingRayhan commented 1 month ago

@DanielRivers yes, perfact 🥳