【发布时间】:2021-01-10 01:30:04
【问题描述】:
我正在尝试根据https://developer.spotify.com/documentation/general/guides/authorization-guide/#client-credentials-flow Client Credentials Flow 上的文档发出 http 请求。
我写过
const BASE_URL = 'https://accounts.spotify.com/api/token';
fetch(BASE_URL, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Authorization': 'Basic ' + base64(clientID) + ':' + base64(clientSecret)
},
body: JSON.stringify({'grant_type:client_credentials'})
})
这是否符合它所说的?我很困惑如何编写发布请求的正文。
【问题讨论】:
标签: javascript authorization spotify