Skip to content

Commit 82b6918

Browse files
authored
Merge pull request #2 from ahmedHusseinF/master
✨ add checkRevoked option for jwt verification
2 parents 7808c03 + 8d161ee commit 82b6918

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/interface/options.interface.ts

+1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ import { JwtFromRequestFunction } from 'passport-jwt';
22

33
export interface FirebaseAuthStrategyOptions {
44
extractor: JwtFromRequestFunction;
5+
checkRevoked?: boolean;
56
}

src/passport-firebase.strategy.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import * as admin from 'firebase-admin';
1010

1111
export class FirebaseAuthStrategy extends Strategy {
1212
readonly name = FIREBASE_AUTH;
13+
private checkRevoked = false;
1314

1415
constructor(
1516
options: FirebaseAuthStrategyOptions,
@@ -23,6 +24,7 @@ export class FirebaseAuthStrategy extends Strategy {
2324
}
2425

2526
this.extractor = options.extractor;
27+
this.checkRevoked = options.checkRevoked;
2628
}
2729

2830
async validate(payload: FirebaseUser): Promise<any> {
@@ -40,7 +42,7 @@ export class FirebaseAuthStrategy extends Strategy {
4042

4143
try {
4244
admin.auth()
43-
.verifyIdToken(idToken)
45+
.verifyIdToken(idToken, this.checkRevoked)
4446
.then((res) => this.validateDecodedIdToken(res))
4547
.catch((err) => {
4648
this.fail({ err }, 401);

0 commit comments

Comments
 (0)