diff --git a/api/src/modules/admin/admin.controller.ts b/api/src/modules/admin/admin.controller.ts index e89f9094..daff0b70 100644 --- a/api/src/modules/admin/admin.controller.ts +++ b/api/src/modules/admin/admin.controller.ts @@ -1,15 +1,15 @@ import { Controller, Headers, UseGuards } from '@nestjs/common'; import { RolesGuard } from '@api/modules/auth/guards/roles.guard'; -import { JwtAuthGuard } from '@api/modules/auth/guards/jwt-auth.guard'; import { RequiredRoles } from '@api/modules/auth/decorators/roles.decorator'; import { tsRestHandler, TsRestHandler } from '@ts-rest/nest'; import { ControllerResponse } from '@api/types/controller-response.type'; import { adminContract } from '@shared/contracts/admin.contract'; import { AuthenticationService } from '@api/modules/auth/authentication.service'; import { ROLES } from '@shared/entities/users/roles.enum'; +import { JwtCookieAuthGuard } from '@api/modules/auth/guards/jwt-cookie-auth.guard'; @Controller() -@UseGuards(JwtAuthGuard, RolesGuard) +@UseGuards(JwtCookieAuthGuard, RolesGuard) @RequiredRoles(ROLES.ADMIN) export class AdminController { constructor(private readonly auth: AuthenticationService) {} diff --git a/backoffice/resources/users/user.actions.ts b/backoffice/resources/users/user.actions.ts index 5fe2e058..5b58ca15 100644 --- a/backoffice/resources/users/user.actions.ts +++ b/backoffice/resources/users/user.actions.ts @@ -20,10 +20,11 @@ export const createUserAction = async ( method: "POST", headers: { "Content-Type": "application/json", - Authorization: `Bearer ${accessToken}`, Origin: response.req.headers.origin, + Cookie: response.req.headers.cookie, // Resend the the client cookies to the API to authenticate the admin via session cookie }, body: JSON.stringify(request.payload), + }); if (!apiResponse.ok) {