From 0ab621d23132818818638c500552e460dfd39f13 Mon Sep 17 00:00:00 2001 From: Thibault Le Ouay Date: Thu, 17 Oct 2024 22:07:42 +0200 Subject: [PATCH 1/2] Improve error message --- .../src/engine/decorators/auth/auth-user.decorator.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/twenty-server/src/engine/decorators/auth/auth-user.decorator.ts b/packages/twenty-server/src/engine/decorators/auth/auth-user.decorator.ts index 75f3a982e949..ebddb75df990 100644 --- a/packages/twenty-server/src/engine/decorators/auth/auth-user.decorator.ts +++ b/packages/twenty-server/src/engine/decorators/auth/auth-user.decorator.ts @@ -15,7 +15,7 @@ export const AuthUser = createParamDecorator( const request = getRequest(ctx); if (!options?.allowUndefined && !request.user) { - throw new ForbiddenException("You're not authorized to do this"); + throw new ForbiddenException("You're not authorized to do this. Note: This endpoint requires a user and won't work with just an API key."); } return request.user; From 9fa4eac466648a74b3c3a86157f4450d51110118 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Malfait?= Date: Thu, 17 Oct 2024 22:29:51 +0200 Subject: [PATCH 2/2] Fix lint --- .../src/engine/decorators/auth/auth-user.decorator.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/twenty-server/src/engine/decorators/auth/auth-user.decorator.ts b/packages/twenty-server/src/engine/decorators/auth/auth-user.decorator.ts index ebddb75df990..35d3ccc08da4 100644 --- a/packages/twenty-server/src/engine/decorators/auth/auth-user.decorator.ts +++ b/packages/twenty-server/src/engine/decorators/auth/auth-user.decorator.ts @@ -15,7 +15,9 @@ export const AuthUser = createParamDecorator( const request = getRequest(ctx); if (!options?.allowUndefined && !request.user) { - throw new ForbiddenException("You're not authorized to do this. Note: This endpoint requires a user and won't work with just an API key."); + throw new ForbiddenException( + "You're not authorized to do this. Note: This endpoint requires a user and won't work with just an API key.", + ); } return request.user;