【发布时间】:2018-08-12 00:58:20
【问题描述】:
我正在用 Java 编写一个与 Spotify Web API 配合使用的应用程序,以获取当前正在播放的专辑的专辑插图(未来可能还有其他内容,因此有很长的范围列表)。根据Spotify's guide,我必须使用回调来获取访问令牌。但是,当使用授权链接时,Spotify 会向我提供以下非常有用和有见地的错误消息。 Spotify Error Message
我用来调用打开窗口的代码是
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 已被询问,他们的问题是他们的回调 URL 未列入白名单;但是,我去了Spotify Dashboard 并确定http://localhost:8888/callback/ 是whitelisted。我试过直接在 URL 中使用 'http://localhost:8888/callback/',我也试过 HTML 转义它,使它变成 'http%3A%2F%2Flocalhost%3A8888%2Fcallback%2F' 如上面的代码所示.谁能告诉我为什么出现错误消息而不是登录页面?
【问题讨论】: