Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URLSearchParams not picking some values #79

Open
sealr00t opened this issue Nov 7, 2022 · 0 comments
Open

URLSearchParams not picking some values #79

sealr00t opened this issue Nov 7, 2022 · 0 comments

Comments

@sealr00t
Copy link

sealr00t commented Nov 7, 2022

I'm trying to extract values from a url that is encoded. but there seems to be a problem with the URLSearchParams class. The first search param in the url right after the '?' symbol is never being picked and always returns a null when quired.

Here's a code snippet to prove it.
let encoded = 'endpoint1/endpoint2/result%3Ftoken=xyz...&id=19bc...&refresh=Swib3...&source=unknown&token_type=Bearer'; try { console.log(decodeURIComponent(encoded)); } catch (e) { console.error(e); } let params = new URLSearchParams(decodeURIComponent(encoded)); let token = params.get("token"); let id = params.get("id"); console.log(token); console.log(id); console.log(params.get("refresh")); console.log(params.get("source")); console.log(params.get("token_type"));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant