File tree 4 files changed +7
-3
lines changed
4 files changed +7
-3
lines changed Original file line number Diff line number Diff line change 7
7
UnauthorizedException ,
8
8
} from '@nestjs/common' ;
9
9
import { Request } from 'express' ;
10
+ import { FIREBASE_ERRORS } from 'src/utils/errors' ;
10
11
import { AuthService } from '../auth/auth.service' ;
11
12
import { UserService } from '../user/user.service' ;
12
13
import { IFirebaseUser } from './firebase-user.interface' ;
@@ -32,7 +33,7 @@ export class FirebaseAuthGuard implements CanActivate {
32
33
user = await this . authService . parseAuth ( authorization ) ;
33
34
} catch ( error ) {
34
35
if ( error . code === 'auth/id-token-expired' ) {
35
- throw new HttpException ( `FirebaseAuthGuard - ${ error } ` , HttpStatus . UNAUTHORIZED ) ;
36
+ throw new HttpException ( FIREBASE_ERRORS . ID_TOKEN_EXPIRED , HttpStatus . UNAUTHORIZED ) ;
36
37
}
37
38
38
39
throw new HttpException (
Original file line number Diff line number Diff line change 8
8
import { InjectRepository } from '@nestjs/typeorm' ;
9
9
import { Request } from 'express' ;
10
10
import { UserEntity } from 'src/entities/user.entity' ;
11
+ import { FIREBASE_ERRORS } from 'src/utils/errors' ;
11
12
import { Repository } from 'typeorm' ;
12
13
import { AuthService } from '../auth/auth.service' ;
13
14
@@ -31,7 +32,7 @@ export class PartnerAdminAuthGuard implements CanActivate {
31
32
userUid = uid ;
32
33
} catch ( error ) {
33
34
if ( error . code === 'auth/id-token-expired' ) {
34
- throw new HttpException ( `PartnerAdminAuthGuard - ${ error } ` , HttpStatus . UNAUTHORIZED ) ;
35
+ throw new HttpException ( FIREBASE_ERRORS . ID_TOKEN_EXPIRED , HttpStatus . UNAUTHORIZED ) ;
35
36
}
36
37
37
38
throw new HttpException (
Original file line number Diff line number Diff line change 8
8
import { InjectRepository } from '@nestjs/typeorm' ;
9
9
import { Request } from 'express' ;
10
10
import { UserEntity } from 'src/entities/user.entity' ;
11
+ import { FIREBASE_ERRORS } from 'src/utils/errors' ;
11
12
import { Repository } from 'typeorm' ;
12
13
import { AuthService } from '../auth/auth.service' ;
13
14
@@ -35,7 +36,7 @@ export class SuperAdminAuthGuard implements CanActivate {
35
36
userUid = uid ;
36
37
} catch ( error ) {
37
38
if ( error . code === 'auth/id-token-expired' ) {
38
- throw new HttpException ( `SuperAdminAuthGuard - ${ error } ` , HttpStatus . UNAUTHORIZED ) ;
39
+ throw new HttpException ( FIREBASE_ERRORS . ID_TOKEN_EXPIRED , HttpStatus . UNAUTHORIZED ) ;
39
40
}
40
41
41
42
throw new HttpException (
Original file line number Diff line number Diff line change @@ -6,4 +6,5 @@ export enum FIREBASE_ERRORS {
6
6
CREATE_USER_INVALID_EMAIL = 'CREATE_USER_INVALID_EMAIL' ,
7
7
CREATE_USER_WEAK_PASSWORD = 'CREATE_USER_WEAK_PASSWORD' ,
8
8
CREATE_USER_ALREADY_EXISTS = 'CREATE_USER_ALREADY_EXISTS' ,
9
+ ID_TOKEN_EXPIRED = 'ID_TOKEN_EXPIRED' ,
9
10
}
You can’t perform that action at this time.
0 commit comments