benxu.AppPlatform.Supabase.Auth
3.2.8
dotnet add package benxu.AppPlatform.Supabase.Auth --version 3.2.8
NuGet\Install-Package benxu.AppPlatform.Supabase.Auth -Version 3.2.8
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="benxu.AppPlatform.Supabase.Auth" Version="3.2.8" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="benxu.AppPlatform.Supabase.Auth" Version="3.2.8" />
<PackageReference Include="benxu.AppPlatform.Supabase.Auth" />
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 benxu.AppPlatform.Supabase.Auth --version 3.2.8
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: benxu.AppPlatform.Supabase.Auth, 3.2.8"
#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 benxu.AppPlatform.Supabase.Auth@3.2.8
#: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=benxu.AppPlatform.Supabase.Auth&version=3.2.8
#tool nuget:?package=benxu.AppPlatform.Supabase.Auth&version=3.2.8
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
benxu.AppPlatform.Supabase.Auth
Supabase Authentication 實作套件,提供 Email/Password、Google OAuth、Apple OAuth 與 Access Token 自動刷新能力,適用於 .NET MAUI App。
功能特色
- 使用
Supabase套件建立原生 MAUI 可用的認證流程。 - 實作既有平台抽象
IAuthService,可直接接上目前 App Platform 的認證流程。 - 支援
Google/AppleOAuth,採用PKCE + WebAuthenticator + deep link callback。 - 內建 Token 自動刷新,並將登入狀態同步到
IAppStateManager。 - 支援 App 重啟後從既有
AuthState還原 Session。
安裝
dotnet add package benxu.AppPlatform.Supabase.Auth
前置設定
- 在 Supabase Dashboard 設定
Auth > URL Configuration,加入 App 的 deep link callback。 - 在 Google / Apple Provider 設定中,將對應 callback URL 加入允許清單。
- 在 MAUI App 平台專案設定 deep link / callback scheme,讓
WebAuthenticator能回到 App。
使用方式
1. 註冊服務
using benxu.AppPlatform.Supabase.Auth.Extensions;
using benxu.AppPlatform.Supabase.Auth.Options;
builder.Services.AddSupabaseAuth(new SupabaseAuthOptions
{
ProjectUrl = "https://your-project.supabase.co",
AnonKey = "YOUR_SUPABASE_ANON_KEY",
GoogleRedirectUri = "com.yourcompany.yourapp://auth/google",
AppleRedirectUri = "com.yourcompany.yourapp://auth/apple",
EnableAutoTokenRefresh = true
});
2. 使用認證服務
@inject IAuthService AuthService
@code {
/// <summary>
/// 觸發 Google 登入
/// </summary>
/// <returns>非同步工作</returns>
private async Task LoginWithGoogleAsync()
{
var result = await AuthService.SignInWithGoogleAsync();
if (result.IsSuccess)
{
Console.WriteLine(result.Data.User.Email);
}
}
}
注意事項
Supabase的 C# Client 由社群維護,不是官方一方套件;本套件目前使用Supabase 1.1.1。SignUpWithEmailAsync()在 Supabase 專案啟用Confirm email時,會出現「建立成功但需先驗證 Email」的情況;此時本套件會回傳可識別的失敗代碼AUTH_EMAIL_CONFIRMATION_REQUIRED。Google/AppleOAuth 目前依賴WebAuthenticator與正確的 deep link callback 設定。
依賴項目
Supabase(1.1.1)benxu.AppPlatform.CoreMicrosoft.Maui.Controls
授權
MIT License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0-android36.0 is compatible. net10.0-ios26.0 is compatible. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0-android36.0
- benxu.AppPlatform.Core (>= 3.2.8)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.1)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.0)
- Microsoft.Maui.Controls (>= 10.0.0)
- Supabase (>= 1.1.1)
- Xamarin.AndroidX.Activity (>= 1.10.1.3)
- Xamarin.AndroidX.Activity.Ktx (>= 1.10.1.3)
- Xamarin.AndroidX.Collection (>= 1.5.0.3)
- Xamarin.AndroidX.Collection.Jvm (>= 1.5.0.3)
- Xamarin.AndroidX.Collection.Ktx (>= 1.5.0.3)
- Xamarin.Build.Download (>= 0.11.4)
-
net10.0-ios26.0
- benxu.AppPlatform.Core (>= 3.2.8)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.1)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.0)
- Microsoft.Maui.Controls (>= 10.0.0)
- Supabase (>= 1.1.1)
- Xamarin.Build.Download (>= 0.11.4)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on benxu.AppPlatform.Supabase.Auth:
| Package | Downloads |
|---|---|
|
benxu.AppPlatform.MAUI.Bootstrap
Bootstrap package for benxu App Platform. Provides fluent API for one-line service registration and lifecycle management. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.2.8 | 47 | 7/7/2026 |