You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Auth emulator: signUp can set validSince one second after auth_time, so Admin SDK rejects the fresh ID token as revoked #11413
firebase-tools 15.29.0 (code unchanged in 15.34.2)
firebase-admin 13.10.0, Node.js
What happens
Rarely, an ID token returned by accounts:signUp in the Auth emulator is rejected by the Admin SDK right away with auth/id-token-revoked, even though nothing revoked it. The emulator's own token check accepts the same token.
Cause
In lib/emulator/auth/operations.js, signUp reads the clock twice:
consttimestamp=newDate();// used for lastLoginAt -> auth_time
...
updates.validSince=toUnixTimestamp(newDate()).toString();// second clock read
Both are truncated to whole seconds. If a second boundary passes between the two reads, auth_time = N and validSince = N + 1. Against the emulator, the Admin SDK always checks revocation (checkRevoked || isEmulator in base-auth.js), so verifyIdToken and verifySessionCookie reject the token because auth_time < tokensValidAfterTime. Refreshing the token does not help, since auth_time stays the same; only a new sign-in does.
Repro
Stub Date so the clock moves from x.999 s to x+1.000 s during one signUp call; the resulting token has auth_time one second before validSince, and admin.auth().verifyIdToken(token) throws auth/id-token-revoked.
Thanks for the detailed report, @elinesaetre! I was able to reproduce the issue, and your observations about the two different Date() reads causing the boundary race condition are correct.
Your suggested fix to reuse the same timestamp (updates.validSince = toUnixTimestamp(timestamp).toString();) is spot on. We'll get a PR open to fix this issue.
Activity
aalej commentedon Nov 4, 2026
Thanks for the detailed report, @elinesaetre! I was able to reproduce the issue, and your observations about the two different
Date()reads causing the boundary race condition are correct.Your suggested fix to reuse the same timestamp (
updates.validSince = toUnixTimestamp(timestamp).toString();) is spot on. We'll get a PR open to fix this issue.