DEV Community

Krypton | Madhusudan Babar
Krypton | Madhusudan Babar

Posted on

How to get the anchors in an URL from server-side or node / express context

     I'm building a Trello bot, for which I need to get the authorization token, the official documentation has listed to frame an auth URL like this:
https://trello.com/1/authorize?expiration=1day&name=MyPersonalToken&scope=read&response_type=token&return_url=${MY_RETURN_URL}&key=${API_KEY}
    when the user clicks allow, the auth token will be sent as the GET method to the return_url given in the auth link…

</p>
Enter fullscreen mode Exit fullscreen mode





This question was originally asked at stackoverflow.com :

I'm building a Trello bot, for which I need to get the authorization token, the official documentation has listed to frame an auth URL like this:


https://trello.com/1/authorize?expiration=1day&amp;name=MyPersonalToken&amp;scope=read&amp;response_type=token&amp;return_url=${MY_RETURN_URL}&amp;key=${API_KEY}

    when the user clicks allow, the auth token will be sent as the GET method to the return_url given in the auth link above.

    so as expected, I'm getting the correct token but it's not in the form of query or param, the URL looks like https://return.url.com#32characterslongstring so how can I parse that token,

I'm using express server, so I tried to get the full URL with req.url, req.originalUrl or tried logging the request object but I'm unable to get that anchored part

     I tried testing locally on my machine but still unable to get the token

    my only concern is to get the token or full URL
let's say, I'm having a URL like https://localhost/param#thisiswhatiwanttoget
so how can I access that part after # on the server-side? or in nodejs / express context.

Top comments (1)

Collapse
 
madhusudanbabar profile image
Krypton | Madhusudan Babar

Thanks for the reply, yes, that's the only thing which worked