I'm getting redirected from a website to my ktor s...
# ktor
j
I'm getting redirected from a website to my ktor server like that: http://localhost:3000/callback#somedata=somedata&moredata=data Is it possible with ktor to read these things after the #?
redirected in the browser
its an oauth2 redirect btw
e
no, browsers do not send the URL fragment (
#...
) to the server
j
in browsers theres like this hashchange event thing
e
yes, the client-side JS has access to the fragment/hash, but the server-side (ktor) does not
it would be much more common to use
?...
query parameters to forward information to the server. if you are stuck with
#
then you need custom JS code to send an additional request in non-fragment form to make it visible on the server
j
can't change that its with that #. Is it easy to do this custom js code / how would I do that?
b
Hmm, maybe intercept this callback with your frontend and then invoke some backend api with hash converted to query string?
j
My problem is that this ktor server is really (or was) only there for receiving this data and doesn't have anything else. After it receives this data the server gets destroyed
In case anyone wondering I just created a static html file which gets these hashes and then makes a get request on my server route