Rogelio Flores Zubillaga
1 min readSep 5, 2019

--

This is how I would add a header dynamically to a given HTTP request:

let myHeaders = new HttpHeaders();
myHeaders = myHeaders.append('Authorization', 'Basic ' + yourToken);
http.get(url, { headers: myHeaders }).pipe(....);

Not really adding it to the proxy config (not possible to add things dynamically there) but the header will go through. How you fetch the token depends on your system and setup.

--

--

Rogelio Flores Zubillaga
Rogelio Flores Zubillaga

Written by Rogelio Flores Zubillaga

I create web and mobile apps for a living. Play soccer for fun. Wish it were the other way around. I write about software, life, and the universe.

No responses yet