I am using an API that gives me names and statistics for NBA players. I have the following code that leads me to a 401 error (unauthorized).
constructor (private http: Http) {}
fullName;
getPlayerName() {
this.http.get('https://api.mysportsfeeds.com/v1.1/pull/nba/2016-2017-regular/cumulative_player_stats.json?playerstats=2PA,2PM,3PA,3PM,FTA,FTM').subscribe(data => {
this.newdata= data.json()
console.log(this.newdata)
this.fullName = data.json().cumulativeplayerstats.playerstatsentry[0].player.FirstName + " " + data.json().cumulativeplayerstats.playerstatsentry[0].player.LastName
}
}
How can I add the username and password for authentication?