Redirect to the initial requested URL including Query parameters

I implemented the login of the application based on the provided vanilla PHP-SDK Sample which works like this:

  • User tries to open a page of the application which is only accessible to logged in users, let’s say /home.php?topic=test&revision=12
  • Check for $auth0->getInfo()
  • If no user loggedin redirect to a login.php page and send the accessing url along (e.g. redirect_to=home.php?topic=test etc. (of course encoded)
  • From there perform the actual login through auth0->login() with the redirect_uri specified to the query-parameter value of redirect_to

It usually works like a charm, but while using sign in with google after redirection all the & chars are encoded to &amp%3B

One workaround for this was to check in the url for those &amp%3B and redirect the user to an url where those are actually replaced with ?. But this seems like a very hacky approach and so I’m wondering if there is a different way of achieving something like that through the SDK alltogether. Is there maybe a specific auth0-concept which I’m missing to achieve that? Or do I have to stick to that hack?