1

When i submit post request to API URL. It fails everytime I include Authorization. When I try to login using API. It works fine. but later on. When I try to get all users using its Auth-token. it fails the request. I am using HttpClient. (@angular/common/http)

const httpHeaders = new HttpHeaders({ 
            'Access-Control-Allow-Credentials': 'true',
            'Access-Control-Allow-Origin': '*',
            'Content-Type': 'application/json',
            'Authorization':  'Bearer ' + environment.authTokenKey });
        const users = this.http.post<User[]>(API_USERS_URL, null, { headers: httpHeaders});
        return users;
Hamid Raza
  • 43
  • 1
  • 7

0 Answers0