apps/api: pass token to Authorization header
This commit is contained in:
parent
bca8a64efd
commit
741a1d69ee
@ -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') {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user