且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

允许对https://accounts.spotify.com/api/token端点的前端JavaScript POST请求

更新时间:2021-07-21 07:50:12

您可以在

You can find an example of using express to perform the authentication flow with Spotify on https://github.com/spotify/web-api-auth-examples (see the authorization_code approach).

您无法获得向/api/token发出客户端请求的访问令牌.您需要向/authorize发出请求,该请求将重定向到您的redirect_uri,该请求本身将与访问令牌交换code.

You can't get an access token making a client-side request to /api/token. You need to make a request to /authorize, which will redirect to your redirect_uri, which itself will exchange a code with an access token.

检查该示例,该示例应满足您的需求.

Check that example, which should cover your needs.