diff --git a/backend/src/services/auth/auth-login-service.ts b/backend/src/services/auth/auth-login-service.ts index e3afb754a..e2d628c99 100644 --- a/backend/src/services/auth/auth-login-service.ts +++ b/backend/src/services/auth/auth-login-service.ts @@ -453,8 +453,13 @@ export const authLoginServiceFactory = ({ const selectedOrg = await orgDAL.findById(organizationId); - // Check if authEnforced is true, if that's the case, throw an error - if (selectedOrg.authEnforced) { + // Check if authEnforced is true and the current auth method is not an enforced method + if ( + selectedOrg.authEnforced && + !isAuthMethodSaml(decodedToken.authMethod) && + decodedToken.authMethod !== AuthMethod.OIDC && + decodedToken.authMethod !== AuthMethod.GOOGLE + ) { throw new BadRequestError({ message: "Authentication is required by your organization before you can log in." });