Bee.OAuth2 1.1.2

dotnet add package Bee.OAuth2 --version 1.1.2
                    
NuGet\Install-Package Bee.OAuth2 -Version 1.1.2
                    
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="Bee.OAuth2" Version="1.1.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Bee.OAuth2" Version="1.1.2" />
                    
Directory.Packages.props
<PackageReference Include="Bee.OAuth2" />
                    
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 Bee.OAuth2 --version 1.1.2
                    
#r "nuget: Bee.OAuth2, 1.1.2"
                    
#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 Bee.OAuth2@1.1.2
                    
#: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=Bee.OAuth2&version=1.1.2
                    
Install as a Cake Addin
#tool nuget:?package=Bee.OAuth2&version=1.1.2
                    
Install as a Cake Tool

Bee.OAuth2

Bee.OAuth2 is a lightweight .NET OAuth2 authentication library that supports multiple providers, including Google, Facebook, LINE, Azure, and Auth0.

Installation

Install via NuGet Package Manager:

dotnet add package Bee.OAuth2

Supported OAuth2 Providers

  • Google
  • Facebook
  • LINE
  • Azure (Microsoft Entra ID)
  • Auth0

Usage Examples

Google OAuth2 Authentication Example

using Bee.OAuth2;
using System;
using System.Threading.Tasks;

class Program
{
    static async Task Main()
    {
        var options = new GoogleOAuth2Options
        {
            ClientId = "your-client-id",
            ClientSecret = "your-client-secret",
            RedirectUri = "http://localhost",
            Scopes = { "openid", "email", "profile" }
        };

        var provider = new GoogleOAuth2Provider(options);
        string authUrl = provider.GetAuthorizationUrl("random_state_string");

        Console.WriteLine($"Open this URL in your browser: {authUrl}");

        Console.Write("Enter authorization code: ");
        string code = Console.ReadLine();

        var token = await provider.GetAccessTokenAsync(code);
        var userInfo = await provider.GetUserInfoAsync(token.AccessToken);

        Console.WriteLine($"User Info: {userInfo}");
    }
}

Facebook OAuth2 Authentication Example

var options = new FacebookOAuth2Options
{
    ClientId = "your-client-id",
    ClientSecret = "your-client-secret",
    RedirectUri = "http://localhost",
    Scopes = { "public_profile", "email" }
};

var provider = new FacebookOAuth2Provider(options);

LINE OAuth2 Authentication Example

var options = new LineOAuth2Options
{
    ClientId = "your-client-id",
    ClientSecret = "your-client-secret",
    RedirectUri = "http://localhost",
    Scopes = { "profile", "openid", "email" }
};

var provider = new LineOAuth2Provider(options);

Azure OAuth2 Authentication Example

var options = new AzureOAuth2Options
{
    ClientId = "your-client-id",
    ClientSecret = "your-client-secret",
    RedirectUri = "http://localhost",
    Scopes = { "openid", "profile", "email" }
};

var provider = new AzureOAuth2Provider(options);

Auth0 OAuth2 Authentication Example

var options = new Auth0OAuth2Options
{
    Domain = "your-domain.auth0.com",
    ClientId = "your-client-id",
    ClientSecret = "your-client-secret",
    RedirectUri = "http://localhost",
    Scopes = { "openid", "profile", "email" }
};

var provider = new Auth0OAuth2Provider(options);

License

This project is licensed under the MIT License.


Bee.OAuth2 (中文)

Bee.OAuth2 是一個輕量級的 .NET OAuth2 驗證函式庫,支援 Google、Facebook、LINE、Azure(Microsoft Entra ID)以及 Auth0。

安裝

透過 NuGet 安裝:

dotnet add package Bee.OAuth2

支援的 OAuth2 驗證提供者

  • Google
  • Facebook
  • LINE
  • Azure(Microsoft Entra ID)
  • Auth0

使用範例

Google OAuth2 驗證範例

using Bee.OAuth2;
using System;
using System.Threading.Tasks;

class Program
{
    static async Task Main()
    {
        var options = new GoogleOAuth2Options
        {
            ClientId = "your-client-id",
            ClientSecret = "your-client-secret",
            RedirectUri = "http://localhost",
            Scopes = { "openid", "email", "profile" }
        };

        var provider = new GoogleOAuth2Provider(options);
        string authUrl = provider.GetAuthorizationUrl("random_state_string");

        Console.WriteLine($"請在瀏覽器中打開此 URL: {authUrl}");

        Console.Write("請輸入授權碼: ");
        string code = Console.ReadLine();

        var token = await provider.GetAccessTokenAsync(code);
        var userInfo = await provider.GetUserInfoAsync(token.AccessToken);

        Console.WriteLine($"用戶資訊: {userInfo}");
    }
}

Facebook OAuth2 驗證範例

var options = new FacebookOAuth2Options
{
    ClientId = "your-client-id",
    ClientSecret = "your-client-secret",
    RedirectUri = "http://localhost",
    Scopes = { "public_profile", "email" }
};

var provider = new FacebookOAuth2Provider(options);

LINE OAuth2 驗證範例

var options = new LineOAuth2Options
{
    ClientId = "your-client-id",
    ClientSecret = "your-client-secret",
    RedirectUri = "http://localhost",
    Scopes = { "profile", "openid", "email" }
};

var provider = new LineOAuth2Provider(options);

Azure OAuth2 驗證範例

var options = new AzureOAuth2Options
{
    ClientId = "your-client-id",
    ClientSecret = "your-client-secret",
    RedirectUri = "http://localhost",
    Scopes = { "openid", "profile", "email" }
};

var provider = new AzureOAuth2Provider(options);

Auth0 OAuth2 驗證範例

var options = new Auth0OAuth2Options
{
    Domain = "your-domain.auth0.com",
    ClientId = "your-client-id",
    ClientSecret = "your-client-secret",
    RedirectUri = "http://localhost",
    Scopes = { "openid", "profile", "email" }
};

var provider = new Auth0OAuth2Provider(options);

授權

本專案採用 MIT License。

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on Bee.OAuth2:

Package Downloads
Bee.OAuth2.WinForms

Bee.OAuth2.WinForms is a Windows Forms library that provides a user interface for OAuth2 authentication. It supports Google, Facebook, LINE, Azure, and Auth0 authentication with an easy-to-use UI component.

Bee.OAuth2.AspNet

Bee.OAuth2.AspNet is an OAuth2 authentication library designed for ASP.NET WebForms / MVC, supporting Google, Facebook, LINE, Azure, and Auth0.

Bee.OAuth2.Desktop

Bee.OAuth2.Desktop is a Windows Forms library that provides a user interface for OAuth2 authentication. It supports Google, Facebook, LINE, Azure, and Auth0 authentication with an easy-to-use UI component.

Bee.OAuth2.AspNetCore

Bee.OAuth2.AspNetCore is an OAuth2 authentication library designed for ASP.NET Core, supporting Google, Facebook, LINE, Azure, and Auth0.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.2 53 8/3/2025
1.1.1 190 7/20/2025
1.1.0 185 7/20/2025
1.0.13 153 6/25/2025
1.0.12 160 6/1/2025
1.0.11 164 5/21/2025
1.0.10 200 4/16/2025
1.0.9 217 4/15/2025