FirebaseAuthAdminException class
Thrown when an admin call of FirebaseAuthAdmin fails.
It extends FirebaseAdminException (and so FirebaseException of firebase_app_dart) with the plugin
auth: it prints as [auth/user-not-found] ....
code is the code of the Firebase Admin SDK for Node.js without its auth/ prefix: user-not-found, not
USER_NOT_FOUND (the code of the REST API, kept in serverCode) and not auth/user-not-found. Errors of
the backend are mapped with the table of the Node SDK; a backend code that is not in it becomes
internal-error, with the code of the backend in serverCode. message never contains a token, a password
or a key.
The codes you are most likely to meet:
| Code | Meaning |
|---|---|
user-not-found |
no user has this uid (or email) |
uid-already-exists, email-already-exists, phone-number-already-exists |
createUser or updateUser with a value another user has |
invalid-uid, invalid-email, invalid-password, invalid-phone-number, invalid-photo-url, invalid-display-name |
an argument was refused before any request |
argument-error |
an argument was refused (a uid or claims of createCustomToken), or the ID token is malformed, has a wrong aud, iss or signature |
forbidden-claim, claims-too-large, invalid-claims |
the claims of setCustomUserClaims use a reserved name, exceed 1000 bytes, or are not JSON |
id-token-expired |
the ID token has expired |
id-token-revoked |
checkRevoked: the tokens of the user were revoked after this one was issued |
user-disabled |
checkRevoked: the account is disabled |
invalid-credential |
no access token could be obtained, or no service account email for signing |
insufficient-permission |
the credential lacks a permission (for example iam.serviceAccounts.signBlob) |
project-not-found, quota-exceeded |
the backend refused the project or throttles it |
network-error |
the request did not reach the backend |
internal-error |
the backend answered with something unexpected |
import 'package:firebase_admin_dart/auth.dart';
Future<AdminUser?> userOrNull(FirebaseAuthAdmin admin, String uid) async {
try {
return await admin.getUser(uid);
} on FirebaseAuthAdminException catch (e) {
if (e.code == 'user-not-found') {
return null;
}
rethrow;
}
}
- Inheritance
-
- Object
- FirebaseAdminException
- FirebaseAuthAdminException
- Implemented types
Constructors
- FirebaseAuthAdminException({required String code, required String message, String? serverCode, int? httpStatus})
-
Creates an exception with the Admin SDK style
code(for exampleuser-not-found) and amessage. The package creates them; you need this only for tests.const - FirebaseAuthAdminException.fromServer(String serverMessage, {int? httpStatus})
-
Maps the error message of the Identity Toolkit API (
serverMessage, for exampleUSER_NOT_FOUNDorINVALID_EMAIL : bad address) to an exception, like the Node Admin SDK does.factory
Properties
- code → String
-
The error code in the style of the Firebase Admin SDKs, without the service prefix:
user-not-found, notauth/user-not-found.no setterinherited - hashCode → int
-
The hash code for this object.
no setterinherited
- httpStatus → int?
-
The HTTP status of the response, when there was one.
finalinherited
- message → String
-
A description of the error. It never contains a token, a password or a key.
no setterinherited
- plugin → String
-
The package that threw the exception, for example
cloud_firestore.finalinherited - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- serverCode → String?
-
The code the backend returned (for example
USER_NOT_FOUND), when the error came from the backend.finalinherited - stackTrace → StackTrace?
-
The stack trace captured where the exception originated, if any.
finalinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited