我正在尝试使用 Spotify api 来获取我的顶级艺术家和歌曲的数据。我遵循此处的授权代码示例https://github.com/spotify/web-api-auth-examples。授权有效,我可以登录并查看我的基本信息,现在我正在尝试获取我的顶级艺术家,但是我收到 400 错误:“仅支持有效的不记名身份验证”。
这是我的代码
app.get('/get_top_artists', function(req, res) {
var authString = 'Basic' + new Buffer(client_id + ':' + client_secret).toString('base64')
var authOptions = {
url: 'https://api.spotify.com/v1/me/top/artists',
headers: {
'Authorization': authString
}, function(res) {
console.log(res)
}
};
request.post(authOptions, function(error, response, body) {
if (!error && response.statusCode === 200) {
var get_top_artists = body.get_top_artists;
res.send({
'get_top_artists': get_top_artists
});
}
});
})
Run Code Online (Sandbox Code Playgroud)
编辑
app.get('/get_top_artists', function(req, res) {
console.log('top artists');
var authOptions = {
url: 'https://accounts.spotify.com/api/token',
form: {
redirect_uri: redirect_uri, …
Run Code Online (Sandbox Code Playgroud) 如何在vue中进行动态下拉,不确定我做错了什么.
在我的HTML中我有......
<div id="app">
<select v-model="selected">
<option disabled value="">Please select one</option>
<option v-for="item in selected"></option>
</select>
Run Code Online (Sandbox Code Playgroud)
我的js看起来像....
new Vue({
el: '#app',
data: {
selected: ["Apache", "Cochise"],
}
})
Run Code Online (Sandbox Code Playgroud)