亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

客戶端范圍不足 - Spotify API Golang

客戶端范圍不足 - Spotify API Golang

Go
智慧大石 2023-03-15 15:36:20
我想將我擁有的所有曲目放在一個新播放列表中的一個片段中,但它會拋出一個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))



查看完整回答
反對 回復 2023-03-15
  • 1 回答
  • 0 關注
  • 127 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號