我想將我擁有的所有曲目放在一個新播放列表中的一個片段中,但它會拋出一個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 關注
- 127 瀏覽
添加回答
舉報
0/150
提交
取消