I'm doing this course in udemy about building 12 different angular 2 apps, and one of them works with Spotify Web API and I'm adding more features to it;
I've learn how to work with simple GET request like
searchMusic(str:string, type='artist'){
this.searchUrl = 'https://api.spotify.com/v1/search?query='+str+'&offset=0&limit=20&type='+type+'&market=US';
return this._http.get(this.searchUrl)
.map(res => res.json());
}
That function requires no auth key
But to get a playlist I need to pass an auth key to the request, otherwise I get an error instead of a Json formatted playlist
How do you append the auth key to the request to get rid of the error?
Thanks!
You may find it helpful if other answers wouldn't work...
You can also generate OAuth Token from below link:
https://developer.spotify.com/web-api/console/get-search-item/
you can try this code import this file
for more information check these links
https://scotch.io/tutorials/angular-2-http-requests-with-observables https://angular.io/docs/ts/latest/guide/server-communication.html#!#override-default-request-options
try this if above not work
i hope this will help