繁体   English   中英

尝试使用Spotify Web Api将歌曲添加到另一个协作播放列表时出现403禁止错误

[英]403 Forbidden error when trying to add song to another collaborative playlist with Spotify Web Api

这是我用来添加带有我制作的按钮的歌曲的代码。 该按钮可以正常工作,因为我可以将歌曲添加到自己的播放列表中。 但是,当尝试将歌曲添加到其他人的协作播放列表时,出现403禁止错误。

我一直在尝试向其添加歌曲的播放列表。我已经能够通过桌面应用将歌曲添加到该播放列表,但是它在我的网页上不起作用。 我不知道这是否是代码错误或API是否不允许协作播放列表中添加了歌曲。 我对该项目的范围是playlist-read-private,playlist-modify-private,playlist-read-collaborative user-library-modify,user-read-private user-read-email 所以我也不认为这是一个问题。

document.getElementById('button1').addEventListener('click', function() {
    var myid=localStorage.getItem('SpotId')
    var playid=localStorage.getItem('URI')
    var trackuris = document.getElementById("selections").value;
    console.log(trackuris)
    var uris=[trackuris];           //create an array with the trackuri stored within
    //adding track to playlist using myid, playid, and uris to fill function
    spotifyApi.addTracksToPlaylist(myid,playid,uris).then(function(data) {
        console.log('Added', data); //logging data returend from spotify to console
        document.getElementById('list').src = document.getElementById('list').src;
        var select = document.getElementById("selections");
        $('#selections').empty();   //deletes previos entries upon adding song to playlist
    });
});

这是API的限制。 只有播放列表所有者才能通过API修改协作播放列表。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM