How to get `post_login_redirect_url` to work
I’d like to redirect my user back where they were after they log in. For that i found the (undocumented) property
post_login_redirect_url
which is only mentioned in the Nextjs SDK docs.
Unfortunately it did not add the search param to the kinde login URL 😦
Then we’ve got the other thing: how to get that URL back in my /callback
endpoint?
I call this await kindeClient.handleRedirectToApp(manager, url)
but what about then?7 Replies
I ended up making a work around storing it in cookies, but wonder if i could make use of this after all?
Hey, i'm curious which SDK are you using please ? Please add its version too
"@kinde-oss/kinde-typescript-sdk": "^2.9.1",
Excuse me. So if i understand your issue correctly it's when passing a value to post_login_redirect_url the params aren't added ? Like if you wanted
post_login_redirect_url: domain.com?redirect=shop
The part ?redirect=shop isn't added ?
I am not familiar with the typescript sdk but i've had this use case and what i've done was to store the page the user was on before signing in (I'm using custom auth with a modal)
Then after the login all users are redirected to /callback where I check for the cookie value to redirect him
i did the same thing, but I was wondering two things:
1. if that parameter doesn’t work why does it exist — it does not add to the URL search params
2. how do I get that redirect URL back inside my callback
I’d rather use the API itself than my own solution, but for now im doing exactly that; storing the URL in a cookie and then restoring it
If the param isn’t working then it might be a bug
It’s mostly a bug yeah. You should open an issue on the GitHub repo. Ive passed it to the team but the issue would be even better
Hi @freddie ,
Thank you for the details. I will check on the issue with the post_login_redirect_url parameter and get back to you shortly.