public virtual async Task AuthenticateAsync(IClientRequest request, CancellationToken token = default)
        {
            var oAuthToken = await GetTokenAsync(token).ConfigureAwait(false);

            if (string.IsNullOrWhiteSpace(oAuthToken))
            {
                if (Options.ThrowIfNoToken)
                {
                    throw new NoTokenException("No token could be found in any stores");
                }

                return;
            }

            request.AddHeader("Authorization", "Bearer " + oAuthToken);
        }
        public Task AuthenticateAsync(IClientRequest request, CancellationToken token = default)
        {
            request.AddHeader(_key, _value);

            return(Task.CompletedTask);
        }
Esempio n. 3
0
 public Task AuthenticateAsync(IClientRequest request, CancellationToken token = default)
 {
     request.AddHeader("Authorization", $"Basic {_encoded}");
     return(Task.CompletedTask);
 }