DEV Community

Krypton | Madhusudan Babar
Krypton | Madhusudan Babar

Posted on

1 1

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.

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (1)

Collapse
 
madhusudanbabar profile image
Krypton | Madhusudan Babar

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

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay