You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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"));
The text was updated successfully, but these errors were encountered:
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"));
The text was updated successfully, but these errors were encountered: