benxu.AppPlatform.Firebase.Auth 3.2.7

dotnet add package benxu.AppPlatform.Firebase.Auth --version 3.2.7
 
NuGet\Install-Package benxu.AppPlatform.Firebase.Auth -Version 3.2.7
 
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.Firebase.Auth" Version="3.2.7" />
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="benxu.AppPlatform.Firebase.Auth" Version="3.2.7" />
 
Directory.Packages.props
<PackageReference Include="benxu.AppPlatform.Firebase.Auth" />
 
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 benxu.AppPlatform.Firebase.Auth --version 3.2.7
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: benxu.AppPlatform.Firebase.Auth, 3.2.7"
 
#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.Firebase.Auth@3.2.7
 
#: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.Firebase.Auth&version=3.2.7
 
Install as a Cake Addin
#tool nuget:?package=benxu.AppPlatform.Firebase.Auth&version=3.2.7
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

benxu.AppPlatform.Firebase.Auth

Firebase Authentication 實作套件 - 使用 Plugin.Firebase.Auth v4.0.0 提供各平台的原生認證功能。

特色

  • 真實 Firebase 整合:使用 Plugin.Firebase.Auth v4.0.0 進行原生 API 呼叫。
  • Google 登入:整合原生 Firebase SDK 實現跨平台 Google 登入(Android: Xamarin.Firebase.Auth,iOS: AdamE.Firebase.iOS.Auth)。
  • Email/Password 登入:完整支援 Firebase Email/Password 認證,包含註冊、登入、密碼重設流程。
  • 自動 Token 刷新:背景服務自動刷新 Access Token,確保無縫使用體驗。
  • 狀態同步:自動將認證狀態同步至 IAppStateManager,與應用程式狀態管理整合。
  • 狀態持久化:應用程式重啟後自動恢復登入狀態。

支援平台

  • Android (完整支援 Email/Password,Google 登入使用原生 SDK)
  • iOS (完整支援 Email/Password,Google 登入使用原生 SDK,最低版本 iOS 15.0)

安裝

  1. 安裝套件:

    dotnet add package benxu.AppPlatform.Firebase.Auth
    
  2. 平台設定:

    • Android: 需將 google-services.json 放置於 Platforms/Android 並設定 Build Action 為 GoogleServicesJson
    • iOS: 需將 GoogleService-Info.plist 放置於 Platforms/iOS 並設定 Build Action 為 BundleResource,且必須指定 LogicalName="GoogleService-Info.plist"
    • iOS 初始化: 在 AppDelegate.csFinishedLaunching 方法中呼叫 Firebase.Core.App.Configure()

使用方式

1. 註冊服務

MauiProgram.cs 中:

using benxu.AppPlatform.MAUI.Bootstrap.Extensions;
builder.UseAppPlatform(options =>
{
 options.UseFirebaseAuth(auth =>
 {
 auth.EnableAutoTokenRefresh = true;
 
 // Android Google 登入設定
 auth.GoogleWebClientId = "YOUR_WEB_CLIENT_ID.apps.googleusercontent.com";
 auth.GoogleRedirectUri = "com.googleusercontent.apps.YOUR_CLIENT_ID:/oauth2redirect";
 });
});

2. 使用認證功能

@inject IAuthService AuthService
@code {
 private async Task Login()
 {
 // Google 登入 (Android)
 var result = await AuthService.SignInWithGoogleAsync();
 
 // 或 Email 登入
 // var result = await AuthService.SignInWithEmailAsync("user@example.com", "123456");
 if (result.IsSuccess)
 {
 Console.WriteLine($"使用者: {result.Data.User.Email}");
 }
 }
}

注意事項

  • Plugin.Firebase.Auth v4.0.0 變更:Google/Facebook/Apple 認證提供者已移除內建支援,本套件已整合原生 Firebase SDK 實現 Google 登入功能。
  • Google 登入:Android 與 iOS 皆已實作,使用 WebAuthenticator 進行 OAuth 流程,並透過原生 SDK 完成 Firebase 認證。
  • iOS 最低版本:iOS 15.0+(Plugin.Firebase v4.0.0 要求)

依賴項目

  • Plugin.Firebase.Auth (v4.0.0)
  • Plugin.Firebase.Core (v4.0.0)
  • Xamarin.Firebase.Auth (Android 原生 SDK)
  • AdamE.Firebase.iOS.Auth (iOS 原生 SDK)
  • benxu.AppPlatform.Core

授權

MIT License - Copyright (c) 2025 benxu

Product 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.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on benxu.AppPlatform.Firebase.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.7 106 6/5/2026
3.2.6 125 5/30/2026
3.2.5 140 4/25/2026
3.2.4 106 4/25/2026
3.2.3 113 4/23/2026
3.2.2 116 4/22/2026
3.2.1 113 4/17/2026
3.2.0 123 4/11/2026
3.1.9 119 4/10/2026
3.1.8 111 4/10/2026
3.1.7 108 4/10/2026
3.1.6 115 4/10/2026
3.1.5 105 4/9/2026
3.1.4 117 4/7/2026
3.1.3 127 3/24/2026
3.1.2 106 3/23/2026
3.1.1 119 3/22/2026
3.1.0 113 3/22/2026
3.0.9 116 3/20/2026
3.0.8 114 3/19/2026
Loading failed