diff --git a/src/auth/auth-api-request.ts b/src/auth/auth-api-request.ts index 8e979d1aed..69f8291183 100644 --- a/src/auth/auth-api-request.ts +++ b/src/auth/auth-api-request.ts @@ -1152,10 +1152,14 @@ 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); } + if (!validator.isNonEmptyString(rawId)) { + throw new FirebaseAuthError(AuthClientErrorCode.INVALID_UID); + } + const request = { federatedUserId: [{ providerId, diff --git a/test/unit/auth/auth.spec.ts b/test/unit/auth/auth.spec.ts index b9675e720b..526bff7749 100644 --- a/test/unit/auth/auth.spec.ts +++ b/test/unit/auth/auth.spec.ts @@ -1397,10 +1397,10 @@ AUTH_CONFIGS.forEach((testConfig) => { .with.property('code', 'auth/invalid-provider-id'); }); - it('should be rejected given an invalid provider uid', () => { + it('should be rejected given an invalid uid', () => { expect(() => auth.getUserByProviderUid('id', '')) .to.throw(FirebaseAuthError) - .with.property('code', 'auth/invalid-provider-id'); + .with.property('code', 'auth/invalid-uid'); }); it('should be rejected given an app which returns null access tokens', () => {