我想将我拥有的所有曲目放在一个新播放列表中的一个片段中,但它会抛出一个Insufficient client scope错误。这是我的代码,客户端是用authfunc copyTracksToPlaylist(filteredTracks []spotify.PlaylistItem, client *spotify.Client, ctx context.Context) error { newPlaylistID := os.Getenv("NEW_PLAYLIST_ID") filteredSongsIDs := extractTracksIDs(filteredTracks) return client.ReplacePlaylistTracks(ctx, spotify.ID(newPlaylistID), filteredSongsIDs...)}我在这里看到了 Python 中的可能解决方案,但我不知道如何通过 zmb3 将其转换为 Go 的 API
1 回答
饮歌长啸
TA贡献1951条经验 获得超3个赞
因此,在查看 GitHub 中的更多代码后,我发现问题出在auth我没有添加必要范围的声明中。它应该看起来像这样:
auth = spotifyauth.New(spotifyauth.WithClientID(os.Getenv("SPOTIFY_ID")), spotifyauth.WithClientSecret(os.Getenv("SPOTIFY_SECRET")), spotifyauth.WithRedirectURL(RedirectUrl), spotifyauth.WithScopes(spotifyauth.ScopeUserReadPrivate, spotifyauth.ScopePlaylistModifyPublic, spotifyauth.ScopePlaylistModifyPrivate, spotifyauth.ScopeUserLibraryRead, spotifyauth.ScopeUserLibraryModify))
- 1 回答
- 0 关注
- 158 浏览
添加回答
举报
0/150
提交
取消
