Skip to content

The open alternative to Salesforce, designed for AI.

Fix: Proper HTTP Status Code Usage for Authentication and Authorization Errors (#9463)

shubham yadav09513b66c4e4
diff --git a/packages/twenty-server/src/engine/core-modules/auth/filters/auth-rest-api-exception.filter.ts b/packages/twenty-server/src/engine/core-modules/auth/filters/auth-rest-api-exception.filter.ts
index 1c256f87e96..6ce2873f5f2 100644
--- a/packages/twenty-server/src/engine/core-modules/auth/filters/auth-rest-api-exception.filter.ts
+++ b/packages/twenty-server/src/engine/core-modules/auth/filters/auth-rest-api-exception.filter.ts
@@ -38,7 +38,7 @@ export class AuthRestApiExceptionFilter implements ExceptionFilter {
return this.httpExceptionHandlerService.handleError(
exception,
response,
- 401,
+ 403,
);
case AuthExceptionCode.GOOGLE_API_AUTH_DISABLED:
case AuthExceptionCode.MICROSOFT_API_AUTH_DISABLED:
@@ -46,7 +46,7 @@ export class AuthRestApiExceptionFilter implements ExceptionFilter {
return this.httpExceptionHandlerService.handleError(
exception,
response,
- 403,
+ 401,
);
case AuthExceptionCode.INTERNAL_SERVER_ERROR:
default: