Skip to content

Basic Auth with HttpFactory #417

Answered by yurii-hunter
igoldin74 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @igoldin74! Do the default request headers work for you? The solution may look something like this

var httpFactory = ClientFactory.Create(name: "http_factory",
    clientCount: 1,
    initClient: (number, context) =>
    {
        var client = new HttpClient();
        client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "Your Oauth token here");
        return Task.FromResult(client);
    });

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@igoldin74
Comment options

Answer selected by igoldin74
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants