Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49121

Ionic Http headers API call

$
0
0

@Louis101 wrote:

Hi,

I have this method so far to make an authorised api call, I am struggling as it is not authrorising, any ideas as to what is missing?

getMethods(url:any) :Observable{
let headers = new Headers();
headers.append(‘Content-Type’, ‘application/json’);
headers.append(‘x-token’, localStorage.getItem(’’));

  return this.http.get(`${API_URL2+url}`,{headers:headers})
            .map((res:Response)=>{
                     return res.json();})
            .catch((error:any)=>Observable.throw(error)||'server error');
}

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49121

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>