无法通过 Spotify Web 使用客户端凭据流修改用户私人数据 API

Can't modify user private data with Client Credential Flow by Spotify Web API

是否有任何方法可以通过客户端凭据流中基于控制台的应用程序通过 Web API 修改播放列表? https://developer.spotify.com/web-api/authorization-guide/#client-credentials-flow

可能不是,但也许我错了?我只想修改我的用户数据。

这里我在 API 规范中创建了问题 https://github.com/spotify/web-api/issues/165

无法使用 Client Credentials oAuth 2.0 flow is that applications can make authenticated requests to a web service without a need to involve an end user. Since a user isn't involved, the requests that can be made from the application is limited. For example, using Spotify's API, you can still make requests to retrieve track metadata, playlist contents, and search for albums. Any endpoint that requires a scope 的其中一项优势,因为它需要用户交互。

因此,如果您有兴趣代表用户发出请求,或者如果您想要访问私有数据,因为用户需要先授予您权限,那么使用客户端凭据根本没有意义。

您需要为此使用隐式授权或身份验证代码流。我建议您进一步阅读 Authorization Guide 中有关受支持的 oAuth 2.0 流程的信息。使用授权代码流程的好处之一是您还将检索一个新的刷新令牌,您可以使用它无限期地检索访问令牌。但是,它需要您编写一个 Web 服务来接受授权码并将其交换为令牌。隐式授权流程没有 return 刷新令牌,因此在访问令牌过期之前只能使用一小时。