From edae5c16c89c01131d6dd5fd468a3d78501aca94 Mon Sep 17 00:00:00 2001 From: Appaji Date: Fri, 16 Aug 2024 10:44:09 +0530 Subject: [PATCH] Check if existing userId is valid before throwing error --- .../src/user/identity-provider/identity-provider.hooks.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/server-core/src/user/identity-provider/identity-provider.hooks.ts b/packages/server-core/src/user/identity-provider/identity-provider.hooks.ts index 0ba3d4f27a..d0b2cb47e4 100755 --- a/packages/server-core/src/user/identity-provider/identity-provider.hooks.ts +++ b/packages/server-core/src/user/identity-provider/identity-provider.hooks.ts @@ -82,7 +82,7 @@ async function checkTokenAuth(context: HookContext, use if (key.data.length > 0) { const user = await context.app.service(userPath).get(key.data[0].userId) - if (userId !== user.id) throw new BadRequest('Cannot make identity-providers on other users') + if (userId && userId !== user.id) throw new BadRequest('Cannot make identity-providers on other users') else return true } }