Spotify API始终认为redirect_url无效

时间:2017-02-16 23:24:45

标签: api callback spotify

所以到目前为止,我已尝试授权应用程序使用spotify API的方法,但无论它表示无效redirect_url。

<a href="https://accounts.spotify.com/authorize/?client_id=bed1f08b5dec405888c5c66c0e7b35ef&
response_type=code&redirect_uri=http://localhost/callback&scope=user-read-private%20user-read-email&
state=34fFs29kd09">Authorize Spotify</a>

我还尝试从Exportify(https://github.com/watsonbox/exportify)借用代码:

authorize: function() {
    client_id = "bed1f08b5dec405888c5c66c0e7b35ef"
    window.location = "https://accounts.spotify.com/authorize" +
      "?client_id=" + client_id +
      "&redirect_uri=" + encodeURIComponent([location.protocol, '//', location.host, location.pathname].join('')) +
      "&scope=playlist-read-private%20playlist-read-collaborative" +
      "&response_type=token";
}

但我仍然无效redirect_url。我已将应用管理面板中的以下网址列入白名单:

有没有人遇到并解决了这个问题?

(编辑:localhost.me试图通过修改主机来使用不是localhosty的东西)

1 个答案:

答案 0 :(得分:2)

因此。在尝试了很多无法解决这个问题的方法之后,我又回到了应用管理页面。事实证明,当您输入URL并单击“添加”时,URL不会列入白名单,而是当您向下滚动到页面底部并点击“保存”时。直到那时我还没有导航或向下滚动。保存按钮可以帮助您保存需要保存的警告。