Skip to content

Commit

Permalink
chore: add logs
Browse files Browse the repository at this point in the history
  • Loading branch information
mdwitr0 committed Apr 10, 2024
1 parent 9585fa1 commit 841a586
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/auth/guards/token-auth.guard.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CanActivate, ExecutionContext, ForbiddenException, Injectable, UnauthorizedException } from '@nestjs/common';
import { CanActivate, ExecutionContext, ForbiddenException, Injectable, Logger, UnauthorizedException } from '@nestjs/common';
import * as ApiKey from 'uuid-apikey';

@Injectable()
Expand All @@ -8,6 +8,12 @@ export class TokenAuthGuard implements CanActivate {
const user = request.raw.user;
const isLimitNotExceeded = request.raw.isLimitNotExceeded;
const token = request?.headers['x-api-key'] || request['query']['token'];
const logger = new Logger();

logger.log(`Auth user form request`, {
token,
request: request.raw.url,
});
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const userToken = ApiKey.toAPIKey(user.token);
Expand Down

0 comments on commit 841a586

Please sign in to comment.