【发布时间】:2020-01-30 05:08:02
【问题描述】:
我正在 Angular 中创建一个项目,并在其中使用 Spotify API。但是,当我想将歌曲添加到我的播放列表时,我会收到 401 响应。
addTrackToPlaylist(songID: string, authToken: string) {
let headers = new HttpHeaders();
headers = headers.append('Authorization', 'Bearer ' + authToken);
this.searchUrl = 'https://api.spotify.com/v1/playlists/6VO88OLaELcJxNhwwIgxam/tracks?uris=spotify:track:' + songID;
return this.http.post(this.searchUrl, { headers })
.pipe(map((response: any) => response));
}
回复:
error: {status: 401, message: "No token provided"}
但是令牌已设置?
【问题讨论】:
标签: angular typescript spotify