K
Kinde4w ago
freddie

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?
No description
7 Replies
freddie
freddieOP4w ago
I ended up making a work around storing it in cookies, but wonder if i could make use of this after all?
IkiTg07
IkiTg074w ago
Hey, i'm curious which SDK are you using please ? Please add its version too
freddie
freddieOP3w ago
"@kinde-oss/kinde-typescript-sdk": "^2.9.1",
IkiTg07
IkiTg073w ago
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
freddie
freddieOP3w ago
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
IkiTg07
IkiTg073w ago
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
Ages
Ages2w ago
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.

Did you find this page helpful?