File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -536,6 +536,9 @@ export class FirebaseAuthRequestHandler {
536536 * In addition to revoking all refresh tokens for a user, all ID tokens issued
537537 * before revocation will also be revoked on the Auth backend. Any request with an
538538 * ID token generated before revocation will be rejected with a token expired error.
539+ * Note that due to the fact that the timestamp is stored in seconds, any tokens minted in
540+ * the same second as the revocation will still be valid. If there is a chance that a token
541+ * was minted in the last second, delay for 1 second before revoking.
539542 *
540543 * @param {string } uid The user whose tokens are to be revoked.
541544 * @return {Promise<string> } A promise that resolves when the operation completes
Original file line number Diff line number Diff line change @@ -167,7 +167,9 @@ describe('admin.auth', () => {
167167 } )
168168 . then ( ( decodedIdToken ) => {
169169 // Verification should succeed. Revoke that user's session.
170- return admin . auth ( ) . revokeRefreshTokens ( decodedIdToken . sub ) ;
170+ return new Promise ( ( resolve ) => setTimeout ( ( ) => resolve (
171+ admin . auth ( ) . revokeRefreshTokens ( decodedIdToken . sub )
172+ ) , 1000 ) ) ;
171173 } )
172174 . then ( ( ) => {
173175 // verifyIdToken without checking revocation should still succeed.
You can’t perform that action at this time.
0 commit comments