From 4067b3672c5b712f7379a5d6bc5e65d526a99af6 Mon Sep 17 00:00:00 2001 From: Ademola Fadumo Date: Mon, 15 Dec 2025 15:28:39 +0100 Subject: [PATCH] fix: federated UID lookup to return invalid-provider-uid error --- src/auth/auth-api-request.ts | 6 +++++- test/unit/auth/auth.spec.ts | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) 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', () => {