FirebaseAuth.NET 1.2.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package FirebaseAuth.NET --version 1.2.0
                    
NuGet\Install-Package FirebaseAuth.NET -Version 1.2.0
                    
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="FirebaseAuth.NET" Version="1.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FirebaseAuth.NET" Version="1.2.0" />
                    
Directory.Packages.props
<PackageReference Include="FirebaseAuth.NET" />
                    
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 FirebaseAuth.NET --version 1.2.0
                    
#r "nuget: FirebaseAuth.NET, 1.2.0"
                    
#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 FirebaseAuth.NET@1.2.0
                    
#: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=FirebaseAuth.NET&version=1.2.0
                    
Install as a Cake Addin
#tool nuget:?package=FirebaseAuth.NET&version=1.2.0
                    
Install as a Cake Tool

πŸ” FirebaseAuth.NET

A simple, cross-platform Firebase Authentication library for .NET 9 apps (MAUI, Blazor, Console, etc.)
Supports Email + Password login, registration, password reset, token persistence with custom secure storage abstraction, account deletion (unregister), and password change.


πŸ“¦ Install from NuGet

dotnet add package FirebaseAuth.NET

NuGet: https://www.nuget.org/packages/FirebaseAuth.NET


🧱 Features

βœ… Email + Password Authentication
βœ… Password Reset
βœ… Change Password
βœ… Auto Token Refresh
βœ… Reusable SecureStorage abstraction
βœ… Works in .NET 9 MAUI, Blazor, WPF, API, or Console
βœ… Account deletion (Unregister)


βš™οΈ Setup in a MAUI App

1️⃣ Create a Secure Storage Adapter

Storage/MauiSecureStorage.cs

using FirebaseAuth.NET.Storage;

namespace MyApp.Storage;

public class MauiSecureStorage : ISecureStorage
{
    public Task SetAsync(string key, string value) => SecureStorage.Default.SetAsync(key, value);
    public Task<string?> GetAsync(string key) => SecureStorage.Default.GetAsync(key);
    public void Remove(string key) => SecureStorage.Default.Remove(key);
}

2️⃣ Register Dependencies

MauiProgram.cs

using FirebaseAuth.NET.Services;
using FirebaseAuth.NET.Storage;
using MyApp.Storage;

public static class MauiProgram
{
    public static MauiApp CreateMauiApp()
    {
        var builder = MauiApp.CreateBuilder();

        // Register Firebase Auth
        builder.Services.AddSingleton<ISecureStorage, MauiSecureStorage>();
        builder.Services.AddSingleton<IFirebaseAuthService>(sp =>
        {
            var logger = sp.GetRequiredService<ILogger<FirebaseAuthService>>();
            var storage = sp.GetRequiredService<ISecureStorage>();
            var http = new HttpClient();
            var apiKey = "YOUR_FIREBASE_API_KEY"; // from Firebase Console
            return new FirebaseAuthService(http, logger, storage, apiKey);
        });

        return builder.Build();
    }
}

3️⃣ Use It Anywhere

using FirebaseAuth.NET.Services;

public partial class LoginPage : ContentPage
{
    private readonly IFirebaseAuthService _auth;

    public LoginPage(IFirebaseAuthService auth)
    {
        InitializeComponent();
        _auth = auth;
    }

    private async void OnLoginClicked(object sender, EventArgs e)
    {
        var user = await _auth.LoginAsync("test@example.com", "password123");
        if (user != null)
            await DisplayAlert("Welcome", $"Logged in as {user.Email}", "OK");
        else
            await DisplayAlert("Error", "Login failed.", "OK");
    }

    private async void OnForgotPasswordClicked(object sender, EventArgs e)
    {
        var success = await _auth.SendPasswordResetEmailAsync("test@example.com");
        await DisplayAlert("Reset Password", success ? "Email sent." : "Failed to send.", "OK");
    }

    private async void OnChangePasswordClicked(object sender, EventArgs e)
    {
        var success = await _auth.ChangePasswordAsync("NewStrongPassword!234");
        await DisplayAlert("Change Password", success ? "Password updated." : "Failed to update password.", "OK");
    }

    private async void OnUnregisterClicked(object sender, EventArgs e)
    {
        var success = await _auth.UnregisterAsync();
        await DisplayAlert("Unregister", success ? "Account deleted." : "Failed to delete account.", "OK");
    }
}

Notes

  • Changing password requires the user to be signed in. For sensitive operations, Firebase may require a recent login; if you receive an error, call LoginAsync again and retry ChangePasswordAsync.

4️⃣ Logout Example

_auth.Logout();

🧩 Advanced

  • Implement your own ISecureStorage (e.g., file, key vault, or mock for testing).
  • Control registration availability using options (default allows registration):
var options = new FirebaseAuthOptions { AllowRegistration = false };
var auth = new FirebaseAuthService(http, logger, storage, "YOUR_FIREBASE_API_KEY", options);

πŸ§ͺ Example Usage (Console App)

var http = new HttpClient();
var storage = new FileSecureStorage(); // your own ISecureStorage implementation
var logger = LoggerFactory.Create(b => b.AddConsole()).CreateLogger<FirebaseAuthService>();

var auth = new FirebaseAuthService(http, logger, storage, "YOUR_FIREBASE_API_KEY");

var user = await auth.RegisterAsync("user@example.com", "password123");
Console.WriteLine($"Registered user: {user?.Email}");

var changed = await auth.ChangePasswordAsync("newP@ssw0rd!");
Console.WriteLine(changed ? "Password changed" : "Change failed");

var deleted = await auth.UnregisterAsync();
Console.WriteLine(deleted ? "Account deleted" : "Delete failed");

🌐 Cross-platform notes

  • Uses ILogger for retry logging instead of Console, suitable for MAUI, Blazor, ASP.NET, WPF, and Console.
  • Storage is abstracted behind ISecureStorage; provide a platform-appropriate implementation.
  • Works with HttpClient everywhere. In Blazor WebAssembly, ensure CORS is allowed for Google Identity Toolkit endpoints (default is fine), and construct HttpClient from DI.

πŸ§‘β€πŸ’» Author

Imre SzΓΌcs
Licensed under MIT


🌟 Contribute

Pull requests and improvements are welcome!
If you find a bug, please open an issue.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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.8.0 104 5/21/2026
1.7.1 516 11/20/2025
1.7.0 426 11/18/2025
1.6.0 249 11/16/2025
1.5.0 170 11/15/2025
1.4.4 302 11/12/2025
1.4.3 236 11/10/2025
1.4.0 194 10/25/2025
1.3.2 133 10/24/2025
1.3.1 137 10/24/2025
1.3.0 130 10/24/2025
1.2.0 139 10/24/2025
1.1.0 200 10/23/2025
1.0.1 204 10/21/2025
1.0.0 186 10/21/2025