From b070c702565964d17b93397daf4054bd6af8e991 Mon Sep 17 00:00:00 2001 From: Remzi Zayid Date: Fri, 15 Sep 2023 17:56:11 -0400 Subject: [PATCH] updated error messaging for auth-api-request.getAccountInfoByFederatedUid() The previous error handling for the getAccountInfoByFederatedUid() method was misleading. In scenarios where the providerId was valid, but the uid was missing or invalid, the system would still return a "invalid-provider-id" error code. Now, the appropriate error code will be returned depending on which validation is failing. --- src/auth/auth-api-request.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/auth/auth-api-request.ts b/src/auth/auth-api-request.ts index c4ba2ac811..d3c18a2a55 100644 --- a/src/auth/auth-api-request.ts +++ b/src/auth/auth-api-request.ts @@ -1152,8 +1152,10 @@ export abstract class AbstractAuthRequestHandler { } public getAccountInfoByFederatedUid(providerId: string, rawId: string): Promise { - if (!validator.isNonEmptyString(providerId) || !validator.isNonEmptyString(rawId)) { + if (!validator.isNonEmptyString(providerId)) { throw new FirebaseAuthError(AuthClientErrorCode.INVALID_PROVIDER_ID); + } else if (!validator.isNonEmptyString(rawId)) { + throw new FirebaseAuthError(AuthClientErrorCode.INVALID_UID); } const request = {