auth library

Firebase Auth admin calls: custom tokens (signed with a service account key, by IAM signBlob, or unsigned for the emulator), users, custom claims, revocation and ID token verification.

Start from a FirebaseAdminApp (exported here too) and call FirebaseAdminAppAuth.auth, or FirebaseAuthAdmin(app).

For trusted code only: servers, CLIs, CI jobs and integration tests. See FirebaseAuthAdmin.

import 'package:firebase_admin_dart/auth.dart';

Future<void> main() async {
  final FirebaseAdminApp app = FirebaseAdminApp.emulator(
    projectId: 'demo-test',
    authEmulatorHost: '127.0.0.1:9099',
  );
  final AdminUser user = await app.auth().createUser();
  final String token = await app.auth().createCustomToken(user.uid);
  print(token.isNotEmpty);
  await app.auth().deleteUser(user.uid);
  await app.close();
}

Classes

AdminCredential
Who the admin calls run as, and how data (custom tokens) gets signed. Pass it to FirebaseAdminApp.
AdminUser
A user account as an administrator sees it: what FirebaseAuthAdmin.getUser returns.
DeleteUserError
One uid that FirebaseAuthAdmin.deleteUsers could not delete.
DeleteUsersResult
What FirebaseAuthAdmin.deleteUsers did.
FirebaseAdminApp
One Firebase project as an administrator reaches it: the project id, the credential, the emulators to use, and the HTTP client. The admin libraries take it: FirebaseAuthAdmin(app) of auth.dart, or app.auth().
FirebaseAuthAdmin
The Firebase Auth admin calls of one FirebaseAdminApp: custom tokens, users, custom claims, revocation and ID token verification. Pure Dart; it talks to the Identity Toolkit REST API.
OAuthAccessToken
An OAuth 2.0 access token and when it expires: what the fetch function of an OAuthTokenProvider returns.
OAuthTokenProvider
A token provider for servers and command line tools: it hands out Google OAuth 2.0 access tokens (of a service account, or of Application Default Credentials) and gets a new one before the current one expires.
VerifiedIdToken
An ID token that FirebaseAuthAdmin.verifyIdToken checked: signed by Google (or by the emulator in emulator mode), for this project, not expired.

Extensions

FirebaseAdminAppAuth on FirebaseAdminApp
app.auth(): the Firebase Auth admin calls of a FirebaseAdminApp.

Exceptions / Errors

FirebaseAdminException
The base of the exceptions of firebase_admin_dart: every admin library throws a subclass of it (FirebaseAuthAdminException of auth.dart).
FirebaseAuthAdminException
Thrown when an admin call of FirebaseAuthAdmin fails.