Plugin.Firebase.Auth
5.0.1
dotnet add package Plugin.Firebase.Auth --version 5.0.1
NuGet\Install-Package Plugin.Firebase.Auth -Version 5.0.1
<PackageReference Include="Plugin.Firebase.Auth" Version="5.0.1" />
<PackageVersion Include="Plugin.Firebase.Auth" Version="5.0.1" />
<PackageReference Include="Plugin.Firebase.Auth" />
paket add Plugin.Firebase.Auth --version 5.0.1
#r "nuget: Plugin.Firebase.Auth, 5.0.1"
#:package Plugin.Firebase.Auth@5.0.1
#addin nuget:?package=Plugin.Firebase.Auth&version=5.0.1
#tool nuget:?package=Plugin.Firebase.Auth&version=5.0.1
Auth
You can use Firebase Authentication to allow users to sign in to your app using one or more sign-in methods, including email address and password sign-in, and federated identity providers such as Google Sign-in and Facebook Login.
Installation
Nuget
Install-Package Plugin.Firebase.Auth
Setup
- Follow the instructions for the basic setup
- Enable Authentication at your project in the Firebase Console.
- When using Plugin.Firebase.Auth.Google, add the following lines of code after calling
CrossFirebase.Initialize():
#if IOS
FirebaseAuthGoogleImplementation.Initialize();
#elif ANDROID
FirebaseAuthGoogleImplementation.Initialize("your-google-request-id-token");
#endif
- The
googleRequestIdTokencan be accessed at the Google API Console (make sure to use the Client-ID of the Web client)
iOS specifics
- Enable keychain entitlement in Entitlements.plist:
<dict>
<key>keychain-access-groups</key>
<array>
<string>$(AppIdentifierPrefix)my.fancy.app</string>
</array>
</dict>
- In case you are using Authentication via Google, add an url scheme to your apps
Info.plist:
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>com.googleusercontent.apps.123456-abcdef</string>
</array>
</dict>
</array>
- For more specific instructions take a look at the official Firebase documentation
Android specifics
- Make sure you have added the SHA-1 fingerprint matching the keystore you've used for signing the app bundle to the android project settings in the firebase console:
- Call
FirebaseAuthImplementation.HandleActivityResultAsync(requestCode, resultCode, data);fromMainActivity.OnActivityResult(...) - If you are on version 2.0.5 or later, add the following package to your project's
.csprojfile to prevent build errors:
<PackageReference Include="Xamarin.AndroidX.Browser" Version="1.6.0.2" />
For more specific instructions take a look at the official Firebase documentation
Usage
Take a look at the documentation for the AdamE.Firebase.iOS.Auth packages, because Plugin.Firebase's code is abstracted but still very similar.
Since code should be documenting itself you can also take a look at the following classes:
- src/.../IFirebaseAuth.cs
- src/.../IFirebaseUser.cs
- tests/.../AuthFixture.cs
- sample/.../AuthService.cs
Language
Set LanguageCode = "fr" (or any BCP-47 code) before invoking an Auth flow that triggers user-facing content such as password-reset emails, email-verification emails, or phone-auth SMS.
Call UseAppLanguage() to reset to the app language.
Error handling
Native Firebase Auth failures are wrapped in CrossPlatformFirebaseAuthException. The wrapper preserves the original native exception in InnerException and exposes stable inspection fields for the native exception type, domain, code, and message.
FirebaseAuthErrorClassifier.TryClassify(...) is an optional, best-effort helper for common failures such as invalid credentials, missing users, user collisions, weak passwords, recent-login requirements, and throttling. Call it explicitly in your app code when you want a simple cross-platform branch. When classification returns null, fall back to NativeExceptionTypeName, NativeErrorDomain, NativeErrorCode, NativeErrorMessage, or InnerException.
public async Task<string?> SignInAsync(string email, string password)
{
try {
await CrossFirebaseAuth.Current.SignInWithEmailAndPasswordAsync(email, password);
return null;
} catch(CrossPlatformFirebaseAuthException ex) {
return FirebaseAuthErrorClassifier.TryClassify(ex) switch {
FirebaseAuthFailure.InvalidCredentials => "Invalid email or password.",
FirebaseAuthFailure.UserNotFound => "No account exists for that email address.",
FirebaseAuthFailure.TooManyRequests => "Too many attempts. Try again later.",
_ => ex.NativeErrorMessage
};
}
}
Migration from v4
Before v5, Auth failures were typically handled by catching FirebaseAuthException and inspecting its normalized Reason value.
In v5:
- Catch
CrossPlatformFirebaseAuthException. - Call
FirebaseAuthErrorClassifier.TryClassify(ex)only if you want a simple cross-platform classification. - Inspect
NativeExceptionTypeName,NativeErrorDomain,NativeErrorCode,NativeErrorMessage, orInnerExceptionwhen you need precise native details. SignOutAsync()now follows the same unified exception model when the underlying native Auth SDK reports a failure.
Release notes
- Version 5.0.0
- Replace the normalized
FirebaseAuthException/FIRAuthErrormodel withCrossPlatformFirebaseAuthException. - Preserve native Firebase Auth exceptions in
InnerExceptionand expose platform-specific metadata for inspection. - Add
FirebaseAuthErrorClassifierfor best-effort, non-exhaustive classification of common Auth failures. - Migrate by catching
CrossPlatformFirebaseAuthException, optionally callingFirebaseAuthErrorClassifier.TryClassify(ex), and using native metadata for precise handling.
- Replace the normalized
- Version 4.0.1
- Add
ReloadCurrentUserAsync()to refresh the currently signed in user from the backend. - Add
LanguageCodeandUseAppLanguage()to control the language used for Auth-generated user-facing flows (reset/verification emails, SMS).
- Add
- Version 4.0.0
- Upgrade baseline to .NET 9+.
- Remove MAUI-specific dependencies (Auth remains usable from non-MAUI mobile .NET projects).
- Android initialization now requires an
ActivityLocatorfunction (e.g.() => Platform.CurrentActivity).
- Android initialization now requires an
- Raise minimum platform versions (iOS 15+, Android 23+).
- Raise minimum Firebase SDK versions (iOS 12.5+, Android BoM 33.0+).
- Remove built-in Auth provider implementations (Facebook/Google/Apple); providers must be implemented directly via native SDKs per platform.
- Version 3.1.2
- Fix NRE with Google Auth when cancelling sign in (#500)
- Version 3.1.1
- Using AdamE.Firebase.iOS.* minimum version 11
- Version 3.1.0
- Update to .net8
- Version 3.0.0
- Swapped Xamarin.Firebase.iOS.Auth (native SDK 8.10.0) for AdamE.Firebase.iOS.Auth (native SDK 10.24.0)
- Version 2.0.7
- Added AddAuthStateListener to FirebaseAuth (PR #246)
- Version 2.0.6
- Fix dates in android AuthTokenResultWrapper (issue #244)
- Version 2.0.5
- Bump up Xamarin.Firebase.Auth from 121.0.8 to 122.2.0 (issue #131)
- Version 2.0.4
- Separating Auth.Google into its own package (PR #210)
- Version 2.0.3
- Return
FirebaseUserinFirebaseAuthImplementation.CreateUserAsync(email, password)method (issue #183)
- Return
- Version 2.0.2
- Bump up Xamarin.Google.iOS.SignIn from 5.0.2.3 to 5.0.2.4 (issue #158)
- Version 2.0.1
- Remove unnecessary UseMaui property from csproj files
- Readd net6.0 tfm
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-android35.0 is compatible. net9.0-browser was computed. net9.0-ios was computed. net9.0-ios18.0 is compatible. 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. |
-
net9.0
- Plugin.Firebase.Core (>= 4.2.0)
-
net9.0-android35.0
- Plugin.Firebase.Core (>= 4.2.0)
- Xamarin.Firebase.Auth (>= 123.0.0)
-
net9.0-ios18.0
- AdamE.Firebase.iOS.Auth (>= 12.5.0.4)
- Plugin.Firebase.Core (>= 4.2.0)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on Plugin.Firebase.Auth:
| Package | Downloads |
|---|---|
|
Plugin.Firebase
The plugin includes cross-platform APIs for Firebase Analytics, Auth, Cloud Messaging, Crashlytics, Dynamic Links, Firestore, Cloud Functions, Remote Config and Storage. |
|
|
Plugin.Firebase.Auth.Google
The plugin includes cross-platform APIs for Firebase Auth. |
|
|
Plugin.Firebase.Auth.Facebook
The plugin includes cross-platform APIs for Firebase Auth. |
|
|
benxu.AppPlatform.Firebase.Auth
Firebase Authentication implementation for benxu App Platform. Provides Google Sign-In, Email/Password authentication with automatic token refresh. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 5.0.1 | 1,189 | 3/7/2026 |
| 4.0.1 | 624 | 3/1/2026 |
| 4.0.0 | 13,474 | 12/28/2025 |
| 3.1.1 | 116,730 | 1/16/2025 |
| 3.1.0 | 33,411 | 11/9/2024 |
| 3.0.0 | 58,241 | 5/29/2024 |
| 2.0.7 | 81,951 | 1/13/2024 |
| 2.0.6 | 7,703 | 1/4/2024 |
| 2.0.5 | 6,495 | 11/22/2023 |
| 2.0.4 | 13,432 | 10/18/2023 |
| 2.0.3 | 18,712 | 7/20/2023 |
| 2.0.2 | 24,360 | 4/27/2023 |
| 2.0.1 | 5,350 | 3/31/2023 |
| 2.0.0 | 7,128 | 3/26/2023 |