Http in node cannot read params

Hello, I'm a newbie to nodered and I'm trying to use the HTTP in node to read the URL parameter of an external URL sent me by a service. the problem is that in the URL that I receive there is not a ? as for parameter but there is an (#)

ex: the external server calls http://localhost:1880/redirect#access_token=sghhdjkeòw
I know that the correct way to read params should be http://localhost:1880/redirect?access_token=hjfkdsòahflak

in this case, I should find in the msg.payload.access_token the result for the access_token

do you have any idea how to solve this?

PS: I cannot modify the external URL format

thank you

Hi @gspagoni

That is not possible to do. Browsers never send the URL fragment (the bit after the #) to the server.

thanks for the quick answer. what i'm trying to do is to make an authentication to a provider using OAuth2.0 flow. if i use the response_type = code i need to make another call to the server, where if i set the response_type = token i got back the token with one call
so i would like avoiding to make 2 calls to get the token
any hints?

thank you

If it is really sending you what you say, I think the full URL is in the response object somewhere, you will need to wade through the object to see where it is, I can never remember. Once you have it as a string, you can easily pull it apart and put the token into a header which is probably where it is needed for the next step I would think.

Can you change the ex call to
and use /redirect/:access_token as the http in url?

1 Like

no i cannot change the format, i know the format is a bit strange but i cannot make any modification

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.