SimpleOAuth2Client.AspNetCore 1.0.0-beta

This is a prerelease version of SimpleOAuth2Client.AspNetCore.
There is a newer version of this package available.
See the version list below for details.
dotnet add package SimpleOAuth2Client.AspNetCore --version 1.0.0-beta
                    
NuGet\Install-Package SimpleOAuth2Client.AspNetCore -Version 1.0.0-beta
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SimpleOAuth2Client.AspNetCore" Version="1.0.0-beta" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SimpleOAuth2Client.AspNetCore" Version="1.0.0-beta" />
                    
Directory.Packages.props
<PackageReference Include="SimpleOAuth2Client.AspNetCore" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SimpleOAuth2Client.AspNetCore --version 1.0.0-beta
                    
#r "nuget: SimpleOAuth2Client.AspNetCore, 1.0.0-beta"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SimpleOAuth2Client.AspNetCore@1.0.0-beta
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SimpleOAuth2Client.AspNetCore&version=1.0.0-beta&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=SimpleOAuth2Client.AspNetCore&version=1.0.0-beta&prerelease
                    
Install as a Cake Tool

About SimpleOAuth2Client.AspNetCore

This repository provide a client for ASP.NET Core based projects that supports parts of the OAuth 2.0 Authorization Framework [RFC6749]

Important Information

At the moment only the authorization grant type "client credentials" is supported. Later the remaining ones are added.

NuGet

PM> Install-Package -Id SimpleOAuth2Client.AspNetCore -Version 1.0.0-alpha

How?

The SimpleOAuth2Client project defines a service interface named IOAuth2Client to request access tokens from a OAuth2 based authorization server. The services is registred with lifetime "Signleton" and can be injected via the ASP.NET Core IoC-Container.

Usage

WebApplicationBuilder builder = WebApplication.CreateBuilder(args);

// Configure the SimpleOAuth2Client
builder.Services.AddSimpleOAuth2Client(options =>
{
    options.ClientId = <ClientId>;
    options.ClientSecret = <ClientSecret>;
    options.TokenEndpoint = <TokenEndpoint>;
});

WebApplication app = builder.Build();

// Inject and use the IOAuth2Client as a service
app.MapGet("/test-access-token-request", async (IOAuth2Client client) =>
{
    Result<AccessToken, OAuth2Error> result = await client.RequestAccessToken();
    if (result.IsFailure)
    {
        return Results.BadRequest(result.Error);
    }

    return Results.Ok(result.Value);
});

app.Run();
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 259 4/12/2023
1.0.0-beta 195 3/27/2023
1.0.0-alpha 196 3/13/2023