Skip to content

Commit

Permalink
authorization: fix error while reading
Browse files Browse the repository at this point in the history
  • Loading branch information
Vagahbond committed Jun 17, 2024
1 parent fba52af commit c15ad37
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/auth/strategies/jwt-refresh.strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class JwtRefreshTokenStrategy extends PassportStrategy(
(request: Request) => {
return (
request?.cookies?.Refresh ||
request?.headers.authorization.split(' ')[1]
request?.headers.authorization?.split(' ')[1]
);
},
]),
Expand All @@ -37,7 +37,7 @@ export class JwtRefreshTokenStrategy extends PassportStrategy(
this.logger.log(`Validating user ${payload.userId}`);

const refreshToken = request?.headers?.authorization
? request?.headers?.authorization.split(' ')[1]
? request?.headers?.authorization?.split(' ')[1]
: request.cookies?.Refresh;

return this.userService.getUserIfRefreshTokenMatches(
Expand Down
2 changes: 1 addition & 1 deletion src/auth/strategies/jwt.strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class JwtStrategy extends PassportStrategy(Strategy) {
(request: Request) => {
return (
request?.cookies?.Authentication ||
request?.headers?.authorization.split(' ')[1]
request?.headers?.authorization?.split(' ')[1]
);
},
]),
Expand Down

0 comments on commit c15ad37

Please sign in to comment.