Bee.OAuth2
1.0.10
See the version list below for details.
dotnet add package Bee.OAuth2 --version 1.0.10
NuGet\Install-Package Bee.OAuth2 -Version 1.0.10
<PackageReference Include="Bee.OAuth2" Version="1.0.10" />
<PackageVersion Include="Bee.OAuth2" Version="1.0.10" />
<PackageReference Include="Bee.OAuth2" />
paket add Bee.OAuth2 --version 1.0.10
#r "nuget: Bee.OAuth2, 1.0.10"
#:package Bee.OAuth2@1.0.10
#addin nuget:?package=Bee.OAuth2&version=1.0.10
#tool nuget:?package=Bee.OAuth2&version=1.0.10
Bee.OAuth2
Bee.OAuth2 is a lightweight .NET OAuth2 authentication library that supports multiple providers, including Google, Facebook, LINE, and Azure.
Installation
Install via NuGet Package Manager:
dotnet add package Bee.OAuth2
Supported OAuth2 Providers
- LINE
- Azure (Microsoft Entra ID)
Usage Examples
Google OAuth2 Authentication Example
using Bee.OAuth2;
using System;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
var options = new TGoogleOAuth2Options
{
ClientId = "your-client-id",
ClientSecret = "your-client-secret",
RedirectUri = "http://localhost",
Scopes = { "openid", "email", "profile" }
};
var provider = new TGoogleOAuth2Provider(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 TFacebookOAuth2Options
{
ClientId = "your-client-id",
ClientSecret = "your-client-secret",
RedirectUri = "http://localhost",
Scopes = { "public_profile", "email" }
};
var provider = new TFacebookOAuth2Provider(options);
LINE OAuth2 Authentication Example
var options = new TLineOAuth2Options
{
ClientId = "your-client-id",
ClientSecret = "your-client-secret",
RedirectUri = "http://localhost",
Scopes = { "profile", "openid", "email" }
};
var provider = new TLineOAuth2Provider(options);
Azure OAuth2 Authentication Example
var options = new TAzureOAuth2Options
{
ClientId = "your-client-id",
ClientSecret = "your-client-secret",
RedirectUri = "http://localhost",
Scopes = { "openid", "profile", "email" }
};
var provider = new TAzureOAuth2Provider(options);
License
This project is licensed under the MIT License.
Bee.OAuth2 (中文)
Bee.OAuth2 是一個輕量級的 .NET OAuth2 驗證函式庫,支援 Google、Facebook、LINE 和 Azure(Microsoft Entra ID)。
安裝
透過 NuGet 安裝:
dotnet add package Bee.OAuth2
支援的 OAuth2 驗證提供者
- LINE
- Azure(Microsoft Entra ID)
使用範例
Google OAuth2 驗證範例
using Bee.OAuth2;
using System;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
var options = new TGoogleOAuth2Options
{
ClientId = "your-client-id",
ClientSecret = "your-client-secret",
RedirectUri = "http://localhost",
Scopes = { "openid", "email", "profile" }
};
var provider = new TGoogleOAuth2Provider(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 TFacebookOAuth2Options
{
ClientId = "your-client-id",
ClientSecret = "your-client-secret",
RedirectUri = "http://localhost",
Scopes = { "public_profile", "email" }
};
var provider = new TFacebookOAuth2Provider(options);
LINE OAuth2 驗證範例
var options = new TLineOAuth2Options
{
ClientId = "your-client-id",
ClientSecret = "your-client-secret",
RedirectUri = "http://localhost",
Scopes = { "profile", "openid", "email" }
};
var provider = new TLineOAuth2Provider(options);
Azure OAuth2 驗證範例
var options = new TAzureOAuth2Options
{
ClientId = "your-client-id",
ClientSecret = "your-client-secret",
RedirectUri = "http://localhost",
Scopes = { "openid", "profile", "email" }
};
var provider = new TAzureOAuth2Provider(options);
授權
本專案採用 MIT License。
Product | Versions 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. |
-
.NETStandard 2.0
- Bee.Base (>= 3.0.5)
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.