Skip to content

Commit

Permalink
Update status code to 401 when ID token expired
Browse files Browse the repository at this point in the history
The previous status code of 500 is incorrect.
  • Loading branch information
swetha-charles committed Apr 3, 2023
1 parent 12df30d commit 6d83021
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/firebase/firebase-auth.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ export class FirebaseAuthGuard implements CanActivate {
try {
user = await this.authService.parseAuth(authorization);
} catch (error) {
if (error.code === 'auth/id-token-expired') {
throw new HttpException(`FirebaseAuthGuard - ${error}`, HttpStatus.UNAUTHORIZED);
}

throw new HttpException(
`FirebaseAuthGuard - Error parsing firebase user: ${error}`,
HttpStatus.INTERNAL_SERVER_ERROR,
Expand Down

0 comments on commit 6d83021

Please sign in to comment.