The discussion revolves around an issue with redirecting after login, where query parameters are lost. emanuele shared their route code, which redirects to the login page and then to the correct controller, but without query parameters.
emanuele temporarily solved the issue by using URL parameters instead of query parameters. However, codinghorror questioned whether URL parameters are the right approach.
techAPJ believed it was a bug in the core and found a similar fix for SSO. After investigating, techAPJ found that redirects with query parameters survive login flow for certain routes and requested more details from emanuele to reproduce the issue.
techAPJ discovered that Discourse only preserves query parameters for pre-defined paths and proposed supporting query parameters for all paths. sam agreed, as long as it is carefully reviewed.
The issue was eventually fixed with a commit to the Discourse repository, as reported by techAPJ.
The redirection to the login page works well, but after login, I get redirected to the correct controller but without the query parameters I had in the original request.
Is there a way around this that doesn’t involve using custom local storage entries/cookies? Am I doing something wrong?
I still don’t know how to preserve query params, but I have solved my own issue by using url params instead of query params (so the route is now /keybase-proofs/new-proof/:username/:kb_username/:sig_hash).
I assumed it was the right way to do it since the query params get lost in the transition. Perhaps I am doing something wrong with destination_url or the redirection to login?
To test it, replace the value of the username query param with your username. The route code is in routes/new-proof.js.es6 and it looks basically the same as the code you posted.