apps/api: pass token to Authorization header

This commit is contained in:
vchikalkin 2023-11-17 11:36:29 +03:00
parent bca8a64efd
commit 741a1d69ee

View File

@ -10,11 +10,13 @@ export class AppController {
constructor(private readonly appService: AppService) {}
@Get('auth')
public async auth(@Req() req: FastifyRequest, @Res() reply: FastifyReply) {
const token = req.cookies[env.COOKIE_TOKEN_NAME];
try {
const token = req.cookies[env.COOKIE_TOKEN_NAME];
this.appService.checkToken(token);
reply.header('Authorization', `Bearer ${token}`);
return reply.send();
} catch {
// if (error.name === 'TokenExpiredError') {