{"id":37036722,"url":"https://github.com/chrispaynter/firebase-auth-dotnet","last_synced_at":"2026-01-14T04:22:19.436Z","repository":{"id":56443095,"uuid":"100472338","full_name":"chrispaynter/firebase-auth-dotnet","owner":"chrispaynter","description":"A .NET API client for Firebase Rest Authentication API that follows Google's API spec as precisely as possible.","archived":false,"fork":false,"pushed_at":"2022-12-07T18:39:23.000Z","size":65,"stargazers_count":17,"open_issues_count":2,"forks_count":7,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-01T07:45:29.224Z","etag":null,"topics":["authentication","dotnet","dotnet-core","firebase","firebase-auth","netstandard"],"latest_commit_sha":null,"homepage":"https://www.nuget.org/packages/Firebase.Auth.Rest","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chrispaynter.png","metadata":{"files":{"readme":"README.md","changelog":"changelog.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-16T09:27:06.000Z","updated_at":"2024-07-02T23:42:28.000Z","dependencies_parsed_at":"2023-01-24T20:15:47.011Z","dependency_job_id":null,"html_url":"https://github.com/chrispaynter/firebase-auth-dotnet","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/chrispaynter/firebase-auth-dotnet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrispaynter%2Ffirebase-auth-dotnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrispaynter%2Ffirebase-auth-dotnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrispaynter%2Ffirebase-auth-dotnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrispaynter%2Ffirebase-auth-dotnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chrispaynter","download_url":"https://codeload.github.com/chrispaynter/firebase-auth-dotnet/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrispaynter%2Ffirebase-auth-dotnet/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28409451,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["authentication","dotnet","dotnet-core","firebase","firebase-auth","netstandard"],"created_at":"2026-01-14T04:22:18.917Z","updated_at":"2026-01-14T04:22:19.428Z","avatar_url":"https://github.com/chrispaynter.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# .NET Firebase Rest Authentication API Client\nA .NET API client for Firebase Authentication REST API that aims to follow the Google Firebase Auth API and documentation exactly.\n\nThe official documentation can be found [here](https://firebase.google.com/docs/reference/rest/auth/), and I link to the appropriate sections of Firebase's docs as we discuss the endpoints below.\n\n**NOTE: This is a work in progress** but the foundation of this library is clean and well tested, so adding endpoints should be straightforward and pull requests are welcome!\n\n## Getting Started\n\n### Installation\nYou can add *firebase-auth-dotnet* to your solution by using Nuget (https://www.nuget.org/packages/Firebase.Auth.Rest)\n\nOn the command line use:\n~~~~\ndotnet add package Firebase.Auth.Rest\n~~~~\n\nIn Nuget package manager use:\n~~~~\nInstall-Package Firebase.Auth.Rest\n~~~~\n\n### Creating The API Service\nThe `FirebaseAuthService` class will contains all the endpoints that the Firebase Rest API offers. This class requires a `FirebaseAuthOptions` object to be passed through in it's constructor, which contians keys required to connect and authentiate with Firebase API.\n\n~~~~\nvar authOptions = new FirebaseAuthOptions()\n{\n    WebApiKey = \"\u003cYOUR PROJECT'S WEB API KEY\u003e\"\n}\n\nvar firebase = new FirebaseAuthService(authOptions);\n~~~~\n\n### Using .NET Core\nIf you are using **dotnet core**, you can configure this at the configuration level, so that `FirebaseAuthService` is injected into your classes automatically configured.\n\nIn your **Startup.cs** file you might do something like this.\n~~~~\npublic void ConfigureServices(IServiceCollection services)\n{\n    var authOptions = configuration.GetSection(\"FirebaseAuth\").Get\u003cFirebaseAuthOptions\u003e();\n    services.AddScoped\u003cIFirebaseAuthService\u003e(u =\u003e new FirebaseAuthService(authOptions));\n}\n~~~~\nThen in your **appsettings.json** or your secrets configuration, add this.\n~~~~\n{\n  \"FirebaseAuth\": {\n    \"WebApiKey\": \"\u003cYOUR PROJECT'S WEB API KEY\u003e\"\n  }\n}\n~~~~\n\n\n# Endpoints\n\n\n\u003e**Only some endpoints are available (for now).**\n\u003e\n\u003eThe SDK is currently being implemented on an endpoint by endpoint basis (as I need them).\nAll code examples use the `FirebaseAuthService` that we saw created in the [Getting Started](#getting-started) section. \n\u003e * [Sign up with email and password](#Sign-up-with-email-and-password)\n\u003e * [Sign in with email and password](#Sign-in-with-email-and-password)\n\u003e * [Re-authenticate with refresh token](#Re-authenticate-with-refresh-token)\n\n\u003e**You can follow Firebase's Official documentation in conjunction with this.**\n\u003e\n\u003eThis client follows the official Firebase Auth Rest API documentation as closely as possible. Thus, for more detailed info there is a link for each endpoint to it's official documentation. \n\n\n\u003e**Only Async method calls are supported** \n\u003e\n\u003eAll endpoints are implemented as standard .NET asynchronous methods.\n\n\n## Sign up with email and password\n\u003eCreates a new email and password user.\n\n|||\n|-----|-----|\n| **Firebase API Endpoint** | `signupNewUser` |\n| **Request C# Type** | `Firebase.Auth.Payloads.SignUpNewUserRequest` |\n| **Response C# Type**| `Firebase.Auth.Payloads.SignUpNewUserResponse` |\n| **Endpoint Official Documentation** | [Go to Firebase](https://firebase.google.com/docs/reference/rest/auth/#section-create-email-password) |\n\n### Example\n~~~~\nvar request = new SignUpNewUserRequest()\n{\n    Email = \"valid@test.com\",\n    Password = \"validpassword\"\n};\n\ntry\n{\n    var response = await firebase.SignUpNewUser(request);\n}\ncatch(FirebaseAuthException e)\n{\n    // App specific error handling.\n}\n\n~~~~\n\n## Sign in with email and password\n\u003eSigns an existing user in with their email and password.\n\n|||\n|-----|-----|\n| **Firebase API Endpoint** | `verifyPassword` |\n| **Request C# Type** | `Firebase.Auth.Payloads.VerifyPasswordRequest` |\n| **Response C# Type**| `Firebase.Auth.Payloads.VerifyPasswordResponse` |\n| **Endpoint Official Documentation** | [Go to Firebase](https://firebase.google.com/docs/reference/rest/auth/#section-create-email-password) |\n\n### Example\n~~~~\nvar request = new VerifyPasswordRequest()\n{\n    Email = \"valid@test.com\",\n    Password = \"validpassword\"\n};\n\ntry\n{\n    var response = await firebase.VerifyPassword(request);\n}\ncatch(FirebaseAuthException e)\n{\n    // App specific error handling.\n}\n\n~~~~\n\n## Re-authenticate with refresh token\n\u003eUses a cached refresh token provided by a previous API response to re-authenticate the user.\n\n|||\n|-----|-----|\n| **Firebase API Endpoint** | `token` |\n| **Request C# Type** | `Firebase.Auth.Payloads.VerifyRefreshTokenRequest` |\n| **Response C# Type**| `Firebase.Auth.Payloads.VerifyRefreshTokenResponse` |\n| **Endpoint Official Documentation** | [Go to Firebase](https://firebase.google.com/docs/reference/rest/auth/#section-refresh-token) |\n\n### Example\n~~~~\nvar request = new VerifyRefreshTokenRequest()\n{\n    RefreshToken = cachedRefreshToken\n};\n\ntry\n{\n    var response = await firebase.VerifyRefreshToken(request);\n}\ncatch(FirebaseAuthException e)\n{\n    // App specific error handling.\n}\n\n~~~~\n\n## Error Handling\nErrors that occur during calls to the Firebase Auth API are thrown as an exception of the type `Firebase.Auth.FirebaseAuthException`.\n\nThis exception object has a property called `Error` which is of the enum type Firebase.Auth.Payloads.FirebaseAuthErrorResponse with the following properties (as per [official documentation](https://firebase.google.com/docs/reference/rest/auth/#section-error-response)).\n\nThe documentation is a bit light from Firebase on this format, I have added a description to each item as per my understanding thus far.\n\n|Name|Type| Description|\n|-----|-----|-----|\n| Errors | `Firebase.Auth.FirebaseAuthError` | A collection of sub errors returned (which I've strongly typed). I've thus far only ever seen one item in this collection and it's always the same error message as per the Message property in the row below. |\n| Code | `System.Int32` | Seems to always be the HTTP status code of the request to Firebase servers.|\n| Message | `System.String` | The error message returned.  |\n| MessageType | `Firebase.Auth.FirebaseAuthMessageType` | An enumeration type created to strongly type error messages returned by Firebase API. See below the section [Handling Error Message Types](#handling-error-message-types) |\n\n### Handling Error Message Types\nThe `MessageType` property is my attempt at creating a strongly typed interface over the error type sent back from Firebase. This is slightly tricky because sometimes the message from firebase might look like this\n\n~~~~\nEMAIL_EXISTS\n~~~~\nwhere other times it might look like this\n~~~~\nINVALID_OOB_CODE: The action code is invalid. This can happen if the code is malformed, expired, or has already been used.\n~~~~\n\nIn the former I could reliably use the `Newtonsoft.Json` library to auto deserialize the enum type, however in the latter, the risk that the string could change slightly and break the deserialization feels quite high.\n\n_However_, it does seem consistent enough that the message string returned by Firebase will always contain the error type at the start of the string, so the `MessageType` property works based on this convention. I can't gaurantee this is the case as it's not covered in the official docs, but thus far it seems solid.\n\n#### Error Message Types\n|Type|FirebaseType| Description|\n|-----|-----|-----|\n|`OperationNotAllowed`|`OPERATION_NOT_ALLOWED`| Password sign-in is disabled for this project. |\n|`EmailExists`|`EMAIL_EXISTS`|The email address is already in use by another account.|\n|`WeakPassword`|`WEAK_PASSWORD`|The password must be 6 characters long or more.|\n|`MissingPassword`|`MISSING_PASSWORD`|Password is required in this request|\n|`InvalidPassword`|`INVALID_PASSWORD`| The password is invalid or the user does not have a password.|\n|`InvalidEmail`|`INVALID_EMAIL`|The email address is badly formatted.|\n|`MissingEmail`|`EMAIL_NOT_FOUND`|There is no user record corresponding to this identifier. The user may have been deleted.|\n|`UserDisabled`|`USER_DISABLED`|The user account has been disabled by an administrator.|\n\n**If the error message cannot be deserialized** and matched to an existing type, `MessageType` will default to the value `Unknown`.\n\u003e More types will be added as more of the Firebase API endpoints are added to the client.\n\n# Unit Tests\nEach endpoint comes with a comprehensive suite of tests to ensure the SDK passes and receives data as expected per the documentation, as well as handles error circumstances.\n### How to configure secrets.json for unit testing\n\nIt is expected by the test suite that a file called `secrets.json` exists in the root directory of the `Firebase.Auth.IntegrationTests` project. This file contains the secret keys needed to access Firebase for these integration tests.\n\nThere is a `.gitignore` file at the root of this project which prevents the `settings.json` file from accidently being committed to the repository with the secrets.\n~~~~\n{\n  \"firebaseWebApiKey\": \"\u003cYOUR FIREBASE PROJECT'S WEB API KEY\u003e\",\n  \"validUserEmail\": \"\u003cTHE EMAIL OF A VALID USER\u003e\",\n  \"validUserPassword\":  \"\u003cTHE PASSWORD OF THE SAME VALID USER\u003e\",\n  \"validDisabledEmail\": \"\u003cTHE EMAIL OF A DISABLED USER\u003e\",\n  \"validDisabledPassword\": \"\u003cTHE PASSWORD OF THE SAME DISABLED USER\u003e\"\n}\n~~~~\n# Publishing Nuget Package\nhttps://docs.microsoft.com/en-us/nuget/guides/create-net-standard-packages-vs2017\n\nYou'll need the MSBuild executable, likely located here:\n`C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\MSBuild\\15.0\\Bin`\n\nI generally add that to my path as I don't need any other version of MSBuild available on the command line.\n\nThe project has been set to generate a nuget packag on build, but to package manually, run this command from the `Firebase.Auth` project directoy.\n~~~~\nmsbuild /t:pack /p:Configuration=Release\n~~~~\n\nThen, once you have the package, to push to nuget\n~~~~\nnuget push Firebase.Auth.Rest.1.0.1.nupkg -Source https://www.nuget.org/api/v2/package\n~~~~\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrispaynter%2Ffirebase-auth-dotnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchrispaynter%2Ffirebase-auth-dotnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrispaynter%2Ffirebase-auth-dotnet/lists"}