protected override async Task <HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { var token = await _oAuthAgent.ReadOrRetrieveAccessToken(); request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token); return(await base.SendAsync(request, cancellationToken)); }
protected override async Task <HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { //if(_environment.IsProduction()) // ENABLE when debugging multiple microservices locally { var token = await _oAuthAgent.ReadOrRetrieveAccessToken(_settings); request.Headers.Authorization = new AuthenticationHeaderValue(AuthScheme.Bearer, token); } return(await base.SendAsync(request, cancellationToken)); }