0
votes

I am writing an application in Java that works with the Spotify Web API to get the album artwork of the currently playing album (and maybe other stuff in the future, hence the long list of scopes). Per Spotify's guide, I have to use callbacks in order to get the access token. However, when using the authorization link, Spotify gives me the following intensely helpful and insightful error message. Spotify Error Message

The code I am using to call open a window is

if(Desktop.isDesktopSupported())
{
    String url = "https://accounts.spotify.com/authorize/";
    url += "client_id="+SpotifyClientID;
    url += "&response_type=code";
    url += "&redirect_uri=http%3A%2F%2Flocalhost%3A8888%2Fcallback%2F";
    url += "&state="+state;
    url += "&scope=playlist-read-private%20playlist-read-collaborative%20user-library-read%20user-read-private%20user-read-playback-state%20user-modify-playback-state%20user-read-currently-playing";
    Desktop.getDesktop().browse(new URI(url));
}

Similar questions have been asked, and their issue was their callback URL was not whitelisted; however, I went to the Spotify Dashboard and made SURE http://localhost:8888/callback/ was whitelisted. I've tried using 'http://localhost:8888/callback/' directly in the URL, and I've also tried HTML escaping it, so that it becomes 'http%3A%2F%2Flocalhost%3A8888%2Fcallback%2F' as shown in the code above. Can anyone give me an insight as to why the error message appears instead of the login page?

1

1 Answers

-2
votes

Figured it out myself. Turns out, I am awesome at links. /s Changed the last '/' in "https://accounts.spotify.com/authorize/" into a '?' so that it would actually receive the parameters I was passing it and it worked perfectly.