@@ -229,7 +229,7 @@ export class FirebaseTokenVerifier {
229
229
* @param clockSkewSeconds - The number of seconds to tolerate when checking the token's iat. Must be between 0-60, and an integer. Defualts to 0.
230
230
* @returns A promise fulfilled with the decoded claims of the Firebase Auth ID token.
231
231
*/
232
- public verifyJWT ( jwtToken : string , isEmulator = false , clockSkewSeconds : number = 0 ) : Promise < FirebaseIdToken > {
232
+ public verifyJWT ( jwtToken : string , isEmulator = false , clockSkewSeconds : number = 5 ) : Promise < FirebaseIdToken > {
233
233
if ( ! isString ( jwtToken ) ) {
234
234
throw new FirebaseAuthError (
235
235
AuthClientErrorCode . INVALID_ARGUMENT ,
@@ -243,13 +243,13 @@ export class FirebaseTokenVerifier {
243
243
'clockSkewSeconds must be an integer between 0 and 60.'
244
244
)
245
245
}
246
- return this . decodeAndVerify ( jwtToken , isEmulator , 0 ) . then ( payload => {
246
+ return this . decodeAndVerify ( jwtToken , isEmulator , clockSkewSeconds ) . then ( payload => {
247
247
payload . uid = payload . sub ;
248
248
return payload ;
249
249
} ) ;
250
250
}
251
251
252
- private async decodeAndVerify ( token : string , isEmulator : boolean , clockSkewSeconds : number = 0 ) : Promise < FirebaseIdToken > {
252
+ private async decodeAndVerify ( token : string , isEmulator : boolean , clockSkewSeconds : number = 5 ) : Promise < FirebaseIdToken > {
253
253
const currentTimestamp = Math . floor ( Date . now ( ) / 1000 ) + clockSkewSeconds ;
254
254
try {
255
255
const rs256Token = this . safeDecode ( token , isEmulator , currentTimestamp ) ;
0 commit comments