Skip to content

Commit f696298

Browse files
committed
Propagate customData in FireBaseError when the user is disabled.
Updated demo app to log the user email on error.
1 parent 7405e7d commit f696298

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed

packages/auth/demo/src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ function onAuthError(error) {
277277
// Handle second factor sign-in.
278278
handleMultiFactorSignIn(getMultiFactorResolver(auth, error));
279279
} else {
280-
alertError('Error: ' + error.code);
280+
alertError('Error: ' + error.code + 'user email : ' + error.customData.email);
281281
}
282282
}
283283

packages/auth/src/api/errors.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ export const SERVER_ERROR_MAP: Partial<ServerErrorMap<ServerError>> = {
189189

190190
// User actions (sign-up or deletion) disabled errors.
191191
[ServerError.ADMIN_ONLY_OPERATION]: AuthErrorCode.ADMIN_ONLY_OPERATION,
192+
[ServerError.USER_DISABLED]: AuthErrorCode.USER_DISABLED,
192193

193194
// Multi factor related errors.
194195
[ServerError.INVALID_MFA_PENDING_CREDENTIAL]:

packages/auth/src/api/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ export async function _performFetchWithErrorHandling<V>(
145145
if ('needConfirmation' in json) {
146146
throw _makeTaggedError(auth, AuthErrorCode.NEED_CONFIRMATION, json);
147147
}
148-
149148
if (response.ok && !('errorMessage' in json)) {
150149
return json;
151150
} else {
@@ -159,6 +158,8 @@ export async function _performFetchWithErrorHandling<V>(
159158
);
160159
} else if (serverErrorCode === ServerError.EMAIL_EXISTS) {
161160
throw _makeTaggedError(auth, AuthErrorCode.EMAIL_EXISTS, json);
161+
} else if (serverErrorCode === ServerError.USER_DISABLED) {
162+
throw _makeTaggedError(auth, AuthErrorCode.USER_DISABLED, json);
162163
}
163164
const authError =
164165
errorMap[serverErrorCode as ServerError] ||

packages/auth/src/core/errors.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,10 @@ export interface AuthErrorParams extends GenericAuthErrorParams {
433433
appName: AppName;
434434
_serverResponse: IdTokenMfaResponse;
435435
};
436+
[AuthErrorCode.USER_DISABLED]: {
437+
appName: AppName;
438+
email: string;
439+
};
436440
[AuthErrorCode.INVALID_CORDOVA_CONFIGURATION]: {
437441
appName: AppName;
438442
missingPlugin?: string;

0 commit comments

Comments
 (0)