0

I working on solving this problem with my very limited knowledge when it comes to OAuth2.

This question revolves around a way that I'm trying to work around it.

I want to retrieve data from a URL, but for the data to be provided, I have to click the link I've constructed to be redirected.

So how can I fetch the desired string?

To sumarize. authorizeURL redirects me to a link where I want to get the code param from.

let url = authorizeURL;
let params = (new URL(url)).searchParams;
var code = params.get('code');
console.log(code);
flx
  • 173
  • 9
  • 1
    You can not _get_ a parameter from authorizeURL, that authorizeURL did not _contain_ to begin with ... _"authorizeURL redirects me to a link where I want to get the code param from"_ - actually, it redirects to the authorization dialog, and then that one redirects back to your app - to the specified redirectUri, and that one gets the code parameter appended. You need to get that parameter when you are "on" the redirectUri page in your system. – CBroe Apr 14 '22 at 09:36
  • using express and create the endpoint from "registered callback url of Oauth2", and you can get the code, state from that req.query – deko_39 Apr 14 '22 at 09:39
  • Im really trying lots of differents things to get it to work. But don't know how to work with express or API overall. Haven't been coding for long, and I've gotten the function that I desire when running Spotify API to work. But this OAuth is holding me by the edge. If anyone of you could offer some help in chat I'd appreciate it a lot. – flx Apr 14 '22 at 10:37

0 Answers0