Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

update org selection error message

Maidul Islam620a423cee41
diff --git a/backend/src/services/auth/auth-login-service.ts b/backend/src/services/auth/auth-login-service.ts
index dacafa0e2b..8090b937ab 100644
--- a/backend/src/services/auth/auth-login-service.ts
+++ b/backend/src/services/auth/auth-login-service.ts
@@ -354,9 +354,12 @@ export const authLoginServiceFactory = ({
// Check if the user actually has access to the specified organization.
const userOrgs = await orgDAL.findAllOrgsByUserId(user.id);
const hasOrganizationMembership = userOrgs.some((org) => org.id === organizationId);
+ const selectedOrg = await orgDAL.findById(organizationId);
if (!hasOrganizationMembership) {
- throw new UnauthorizedError({ message: "User does not have access to the organization" });
+ throw new UnauthorizedError({
+ message: `User does not have access to the organization named ${selectedOrg?.name}`
+ });
}
await tokenDAL.incrementTokenSessionVersion(user.id, decodedToken.tokenVersionId);