await new Deno.Command('cmd', {
args: [
'/c',
'start',
`https://accounts.spotify.com/authorize?${new URLSearchParams({
client_id,
response_type: 'code',
redirect_uri: 'http://localhost:8080/callback',
scope: 'user-library-read',
})}`.replaceAll(/&/g, '"&"'),
],
stdout: 'piped',
stderr: 'piped',
}).output();
I am facing a challenge when trying to open a specific URL in my browser using Deno on a Windows system. The URL that actually opens is modified as follows:
https://accounts.spotify.com/authorize?client_id=x\&\response_type=code\&\redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Fcallback\&\scope=user-library-read
The issue here is that the character "
gets replaced with \
. If I don't enclose the &
in quotes within the URL parameters, only one parameter gets opened as shown below:
https://accounts.spotify.com/authorize?client_id=x
My goal is to successfully open the complete URL with all its parameters in the browser, but I'm unsure about the correct approach to achieve this.