Answers for "passing authorization header in typescript http request"

0

passing authorization header in typescript http request

import { HttpClient, HttpHeaders } from '@angular/common/http';

...
constructor(private http: HttpClient){}
...
const httpOptions = {
        headers: new HttpHeaders({
          'Content-Type':  'application/json',
          'Authorization': environment.key
          })
        };
    this.http.post(environment.APIUrl, httpOptions).subscribe(
      response => {
      console.log(response);
    });
...
Posted by: Guest on September-09-2021

Code answers related to "passing authorization header in typescript http request"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language