javascript - 在交换访问令牌的代码时获取“grant_type 参数丢失”,Spotify API PKCE 流
问题描述
我正在尝试实现 PKCE 流程。在第一步中,我生成了代码验证器和质询并请求了代码。现在我应该用代码交换访问令牌。有关流程的更多信息:https ://developer.spotify.com/documentation/general/guides/authorization-guide/#authorization-code-flow-with-proof-key-for-code-exchange-pkce
axios({
method: "POST",
url: "https://accounts.spotify.com/api/token",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
params: qs.stringify({
client_id: client_id,
grant_type: "authorization_code",
code: responseCode,
redirect_uri: "http://localhost:3000/",
code_verifier: verifier
})
}).then(function (response) {
console.log(response);
}).catch(function (err) {
console.log(err);
})
解决方案
推荐阅读
- java - 是否可以部分生成 CSR?直到在一台计算机上散列并在其他地方使用私钥签名的步骤?
- javascript - 通过控制器显示消息“已标记出勤”
- php - SIP2 不支持 php 中的 TLS1.2 协议
- python - 如何在 Lambda python 函数中将 dynamodb json 转换为 json
- awk - awk:如何在 ENDFILE 中“下一个文件”?
- python - python中的MLE用于2个参数
- node.js - Google 课堂 API - 创建具有活动状态的课程并使用服务帐户错误
- javascript - 如何将javascript文件迁移到打字稿中
- javascript - Onclick 事件添加和删除元素
- mysql - 为什么即使我不使用它,多个索引的查询也会变得很慢