Skip to content

Managed .NET (C#) library for use with HttpClient to transparantly call authorized WebAPI

License

Notifications You must be signed in to change notification settings

CogniStreamer/oauth2-client-handler

 
 

Repository files navigation

OAuth2 Client Handler

Build status

Managed .NET (C#) library for use with HttpClient to transparantly call authorized remote API.

Get it on NuGet

Install-Package OAuth2ClientHandler

Usage

var options = new OAuthHttpHandlerOptions
{
    AuthorizerOptions = new AuthorizerOptions
    {
        AuthorizeEndpointUrl = new Uri("http://localhost/authorizer"),
        TokenEndpointUrl = new Uri("http://localhost/token"),
        ClientId = "MyId",
        ClientSecret = "MySecret",
        GrantType = GrantType.ClientCredentials
    }
};

using (var client = new HttpClient(new OAuthHttpHandler(options)))
{
    client.BaseAddress = new Uri("http://localhost");
    var response = await client.GetAsync("/api/protected_api_call");
    // ...
}

About

Managed .NET (C#) library for use with HttpClient to transparantly call authorized WebAPI

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%