How to use a token in a header to GET api


#1

createHeaders(headers:Headers) {

let options: IConnectionOptions = { qs:{userId:1, token: '"};

	console.log("Stage 1");
		//Header for 'this.singalR.connect'
    this.signalR.connect(options)
        .then((connection) => {                      
    
            console.log("Client Id: " + connection.id);                     
         }, (err) => {
            console.log("SignalR Error: " + JSON.stringify(err));
        });
    
this.storage.getItem('token')
.then(
  (token) => { console.log('Bearer ' + token);
    headers.append('Authorization', 'Bearer ' + token); 
  },
  (error) => console.error(error)
);
	  
headers.append('AllowEntry', btoa(this.allow_entry)); 

headers.append('Content-Type', 'application/json');

 this.http.get('http://sportspecific.digitaltesting.net/api/v1/collection/21')

.map(res => res.json())
.subscribe(data => {
this.data = data.data;
console.log(data.data);
});

}

I want to make an API call but I am struggling, this is how far I have got but still having no luck. Thanks in advance for any help