I m trying to do a get request from my ionic 4 project but I need to use username and password for it or else I get error 403
here is my code :
constructor(public httpClient: HttpClient){
this.items = this.httpClient.get('http://www.fostania.com/api/items/');
this.items.subscribe(data => {
console.log('my data: ', data);
})
}
Where should i add the username and password for this??
UPDATE
tried to do it like 'http://username:password@www.fostania.com/api/items/'
but still gives me the error
HttpErrorResponse {headers: HttpHeaders, status: 403, statusText: "Forbidden", url: "http://www.fostania.com/api/items/", ok: false, …}