twenty/packages/twenty-server
Weiko b1aa115d28
Fix auth exceptions (#6590)
A regression has been introduced in
https://github.com/twentyhq/twenty/pull/6459/files#diff-0a06bf2b624f77f1b7ded0fcc4ce266d1a56f4329222b46d1cf4d76a18000c97L505
where 401 have been changed to 403. However the renew token logic on the
FE expects a 401, see here
https://github.com/twentyhq/twenty/blob/main/packages/twenty-front/src/modules/apollo/services/apollo.factory.ts#L100

I've also introduced a fix with a proxy class in
GraphQLHydrateRequestFromTokenMiddleware since this middleware calls
validateToken from tokenService which are never converted back to
graphqlErrors so handleExceptionAndConvertToGraphQLError below will
receive an AuthException and will send capture it and return it as a 500

both issues have been fixed and should resolve the renewToken logic 

## Test
tested locally by playing with token expiration dates in the env

<img width="635" alt="Screenshot 2024-08-09 at 12 47 05"
src="https://github.com/user-attachments/assets/e93d5741-29b7-4699-b882-ee8f4fee6e6e">
2024-08-09 14:09:26 +02:00
..
@types feat: add new ACTOR field type and createdBy standard fields (#6324) 2024-08-03 15:43:31 +02:00
patches feat: created by email calendar (#6536) 2024-08-07 15:03:06 +02:00
scripts Update render deploy configuration (#6167) 2024-07-09 00:27:07 +02:00
src Fix auth exceptions (#6590) 2024-08-09 14:09:26 +02:00
test Deprecate address standard field (#6087) 2024-07-10 18:07:18 +02:00
.env.example 6181 workflows create a custom code executor (#6235) 2024-07-17 17:53:01 +02:00
.env.test Rename mutation maximum affected records (#6042) 2024-06-26 18:00:25 +02:00
.eslintrc.cjs feat: add eslint rule for enforcing WorkspaceService naming convention (#6308) 2024-07-19 19:17:57 +02:00
.gitignore feat: workspace:health nullable fix (#3882) 2024-02-08 18:22:29 +01:00
.prettierignore Migrate to a monorepo structure (#2909) 2023-12-10 18:10:54 +01:00
.prettierrc Migrate to a monorepo structure (#2909) 2023-12-10 18:10:54 +01:00
.swcrc feat: twenty orm for standard and custom objects (#6178) 2024-07-19 18:23:52 +02:00
jest.config.ts 4840 multi workspace update user userworkspace inconsistent on delete set null constraint (#5373) 2024-05-13 14:50:27 +02:00
nest-cli.json chore: use Nx affected tasks in CI (#5110) 2024-04-30 16:28:25 +02:00
package.json Bump version to 0.23.1 (#6567) 2024-08-07 17:09:30 +02:00
project.json Leverage workspace activationStatus to decide if a workspace is activated or not (#6497) 2024-08-01 17:05:15 +02:00
tsconfig.build.json chore: set up twenty-emails config so build isn't needed in development (#3619) 2024-01-29 06:17:12 -03:00
tsconfig.json feat: twenty orm for standard and custom objects (#6178) 2024-07-19 18:23:52 +02:00