apps/api: add cookie options (httpOnly, secure)

This commit is contained in:
vchikalkin 2023-10-30 16:39:02 +03:00
parent 79d8e89874
commit 7b73758d70

View File

@ -3,17 +3,20 @@
/* eslint-disable import/no-extraneous-dependencies */
import { AuthService } from './auth.service';
import { Credentials } from './types/request';
import type { CookieSerializeOptions } from '@fastify/cookie';
import { Body, Controller, Get, HttpException, HttpStatus, Post, Req, Res } from '@nestjs/common';
import { FastifyReply, FastifyRequest } from 'fastify';
import { env } from 'src/config/env';
@Controller()
export class AuthController {
cookieOptions: { maxAge: number; path: string };
cookieOptions: CookieSerializeOptions;
constructor(private readonly authService: AuthService) {
this.cookieOptions = {
httpOnly: true,
maxAge: env.API_TOKEN_TTL,
path: '/',
secure: true,
};
}