Introducing the Firebase Admin SDK for .NET

Since we launched the Firebase Admin SDKs for Python and Go last year, many developers have asked for an SDK for .NET. Today, we are happy to announce the general availability of the Firebase Admin SDK for .NET.

Firebase Admin SDKs enable application developers like you to access Firebase from back-end environments. They complement the Firebase client SDKs, which let you access Firebase from web and mobile apps. The Admin SDK for .NET is the fifth SDK variant to join our growing collection of Admin SDK offerings. The SDK currently supports .NET Framework 4.5+ and .NET Standard 1.5+.

Initializing the Admin SDK for .NET

The .NET Admin SDK can be initialized with several different types of authorization credentials. The following code snippet shows how to initialize the SDK using a service account credential obtained from the Firebase console:

using FirebaseAdmin;
using Google.Apis.Auth.OAuth2;

FirebaseApp.Create(new AppOptions()
  Credential = GoogleCredential.FromFile("path/to/serviceAccount.json"),

If you are running your code on Google Cloud Platform, such as Google App Engine or Google Compute Engine, the SDK can auto-discover application default credentials from the environment. In this case you do not have to specify any credentials at initialization:

using FirebaseAdmin;


Creating Custom Tokens and Verifying ID Tokens

The initial release of the .NET Admin SDK comes with APIs for creating custom tokens and verifying ID tokens for Firebase Authentication. Custom token creation allows you to integrate your own user store or authentication mechanism with Firebase:

using System.Collections.Generic;
using FirebaseAdmin.Auth;

// Add some custom claims to the token, which will be available on the
// ID token after successful sign in.
var claims = new Dictionary<string, object>()
  { "premium", true },
  { "package", "gold" },
using FirebaseAdmin.Auth;

var customToken = await FirebaseAuth.DefaultInstance.CreateCustomTokenAsync(
    "some-uid", claims); 

ID token verification lets you securely validate the identity of the currently signed in user on your server. You can use this API to build authorized back-end services that integrate with Firebase:

var decoded = await FirebaseAuth.DefaultInstance.VerifyIdTokenAsync(idToken);
var uid = decoded.Uid; 

To learn more about using the Firebase Admin SDK for .NET, see the Admin SDK setup guide.

”.NET Developers Assemble”

Admin SDK for .NET is fully open source. We welcome and encourage our developer community to help us develop this SDK further. Please file bugs and feature requests as GitHub issues, and also feel free to send us pull requests implementing new features and APIs. You can refer to our other Admin SDK implementations for ideas and inspiration.

We look forward to working with you on the Admin SDK for .NET. Happy coding with Firebase!