“415 错误"当向 Spotify 查询令牌时 [英] "415 Error" when querying Spotify for tokens
本文介绍了“415 错误"当向 Spotify 查询令牌时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直在尝试在 MeteorJS 中重新创建 Spotify oauth 连接.我已经请求访问和刷新令牌,但我现在不断收到 415 错误.相关代码如下:
I've been trying to recreate the spotify oauth connection in MeteorJS. I've gotten as far as requesting the access and refresh tokens, but I keep getting a 415 error now. Here is the relevant code:
var results = HTTP.post(
'https://accounts.spotify.com/api/token',
{
data: {
code: code,
redirect_uri: redirectURI,
grant_type: 'authorization_code',
client_id: clientID,
client_secret: clientSecret
},
headers: {
'Content-Type':'application/json'
}
}
);
我似乎在这个演示中找不到关于问题和代码的任何其他好的文档:
I can't seem to find any other good documentation of the problem and the code in this demo:
https://github.com/spotify/web-api-auth-examples/tree/master/authorization_code
完美运行.
推荐答案
我遇到了类似的问题(但在 Java 中).类似的解决方案是
I had a similar problem (but in Java). The analogous solution was
headers: {
'Content-Type':'application/x-www-form-urlencoded'
}
这篇关于“415 错误"当向 Spotify 查询令牌时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文