# oauth2-client-handler **Repository Path**: coldliang/oauth2-client-handler ## Basic Information - **Project Name**: oauth2-client-handler - **Description**: Managed .NET (C#) library for use with HttpClient to transparantly call authorized WebAPI - **Primary Language**: C# - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2019-05-21 - **Last Updated**: 2020-12-18 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # OAuth2 Client Handler [![Build status](https://ci.appveyor.com/api/projects/status/9fepyg7kuhgmulh1/branch/master?svg=true)](https://ci.appveyor.com/project/huysentruitw/oauth2-client-handler/branch/master) Managed .NET library for use with HttpClient to transparantly call authorized remote API protected with OAuth2 or OpenID Connect. Supports .NET Framework 4.5+ and .NET Standard / .NET Core. ## Get it on NuGet PM> Install-Package OAuth2ClientHandler ## Usage ```C# 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"); // ... } ```