【发布时间】:2021-09-28 05:35:53
【问题描述】:
由于 Soundcloud API 的新更新,我正在尝试更新我的代码中的身份验证流程(该项目使用登录名和密码)。
但我被一个问题挡住了,我正在失去理智。
我按照此页面上的说明进行操作:https://developers.soundcloud.com/blog/security-updates-api
我设法获得了一个刷新令牌和一个访问令牌:
curl --request POST \
--url https://api.soundcloud.com/oauth2/token \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data client_id=CLIENT_ID \
--data client_secret=CLIENT_SECRET \
--data grant_type=client_credentials
但我无法使用我在上一个请求中获得的访问令牌执行此请求,这是提及页面中的一个示例:
curl --request GET \
--url 'https://api.soundcloud.com/me/tracks?limit=1' \
--header 'Authorization: OAuth ACCESS_TOKEN'
请求响应总是:{"code":401,"message":"","link":"https://developers.soundcloud.com/docs/api/explorer/open-api","status":"401 - Unauthorized","errors":[],"error":null}
我尝试刷新我的访问令牌,并使用网址“https://api.soundcloud.com/me”而不是“https://api.soundcloud.com/me/tracks?limit=1 ”。 并且总是返回相同的错误。
有人可以帮我吗?
提前致谢,感谢阅读。
【问题讨论】:
-
你是在用 curl 发出实际的请求吗?
-
@maio290 我一开始使用 SDK,最后使用 curl。我使用 curl 来检查我必须在 SDK 中实现的请求。