Guide
auth/id-token-expired
How this guide was made: Written with AI assistance and checked against the sources linked on this page.
Updated
Short answer: auth/id-token-expired means the Firebase ID token your server received has expired. Firebase ID tokens last an hour. Fix it by getting the token from the signed-in user right before each request, and sending that token to your server over HTTPS. Our suggestion: do not store a token and reuse it later.
What does auth/id-token-expired mean?
The Firebase Admin SDK returns this code with the message: "The provided Firebase ID token is expired." (Firebase: Admin SDK errors)
Your server calls verifyIdToken to check the token. The docs say that call succeeds only if the token "has the correct format, is not expired, and is properly signed." (Firebase: Verify ID tokens) The token that fails is older than its lifetime. Firebase's session guide says: "Firebase ID tokens are short lived and last for an hour; the refresh token can be used to retrieve new ID tokens." (Firebase: Manage sessions)
Which cause is it?
| What you see | Cause | Fix |
|---|---|---|
| The error appears on a request that reuses a token saved earlier | The app stores the ID token and sends it after it expires | Cause 1 |
| The error appears on a background job or retry that runs later | The job reuses the token from the original request | Cause 2 |
| The error says the token was revoked, not expired | The token was revoked, so the code is auth/id-token-revoked | Cause 3 |
| The error mentions a session cookie | The code is auth/session-cookie-expired, a different flow | Cause 4 |
1. The app sends a stored token
Firebase's web reference says getIdToken "Returns the current token if it has not expired or if it will not expire in the next five minutes. Otherwise, this will refresh the token and return a new one." (Firebase JS SDK: User) So the call to get the token must run each time you need it. A value you saved in a variable, local storage or a cookie does not refresh by itself.
- Find where your server receives the ID token. Search your code for verifyIdToken, then trace where the token comes from.
- On the client, get the token from the signed-in user before each request. Firebase's verify page uses this form:
firebase.auth().currentUser.getIdToken(/* forceRefresh */ true).then(function(idToken) { - Send the token to your server over HTTPS. The verify page says: "after a successful sign-in, send the user's ID token to your server using HTTPS."
- Remove any code that saves the ID token and sends it later.
- Test with a request made now, not with a token from an earlier session.
2. A retry or job reuses the old token
If a retry, queue item or scheduled job carries a token from the first request, the token can expire before the job runs.
- Find the retry or job code path.
- Our suggestion: do not put the ID token in the job payload. Send the request from the client, or have the client get a new token before it calls your server again.
- Our suggestion: if the job must run later, store the user's UID after your server has verified the first request, and plan a new token path for it.
- Test the retry after a wait longer than an hour, and confirm it does not reuse the old token.
3. The token was revoked (a different code)
The verify page says that verifyIdToken "does not check whether or not the token has been revoked." To check revocation, the docs say "the additional checkRevoked boolean flag has to be passed to verifyIdToken." (Firebase: Verify ID tokens) The Admin errors page lists this as auth/id-token-revoked: "The Firebase ID token has been revoked." (Firebase: Admin SDK errors)
- If you see auth/id-token-revoked, the fix is different. Have the user sign in again to get a new token.
- If you want to check revocation, pass checkRevoked in verifyIdToken. The session guide says this check is "an expensive operation, requiring an extra network round trip." (Firebase: Manage sessions)
4. A session cookie expired (a different code)
The Admin errors page lists auth/session-cookie-expired: "The provided Firebase session cookie is expired." Its code is for session cookies, not ID tokens. (Firebase: Admin SDK errors)
- If the error mentions a session cookie, create a new session cookie for the user after a fresh sign-in.
- Our suggestion: check which code your server logs. Only auth/id-token-expired means the ID token itself expired.
Server code as Firebase shows it
Firebase's Admin verify page shows this Node.js pattern. Your server catches the error and returns a response. The docs do not say what the response should be.
getAuth()
.verifyIdToken(idToken)
.then((decodedToken) => {
const uid = decodedToken.uid;
// ...
})
.catch((error) => {
// Handle error
});
Our suggestion: in the catch block, check error.code for 'auth/id-token-expired', and return an error that tells the client to get a fresh token and send the request again.
How do I check it's fixed?
- Our suggestion: sign in on your live app in a private window and run the action that sends the token.
- Confirm the server accepts the request and the action completes.
- Make a second request from the same page a few minutes later. The client should send a current token, and the server should accept it.
- For the expired-token path, test with a token saved from an earlier session. The server should return the expired error, and the client should get a fresh token and retry.
FAQ
How long does an ID token last?
The Firebase session guide says: "Firebase ID tokens are short lived and last for an hour." (Firebase: Manage sessions)
Does getIdToken return an expired token?
No. The Firebase JS reference says it returns the current token if it has not expired and will not expire in the next five minutes. Otherwise it refreshes the token. (Firebase JS SDK: User)
Does verifyIdToken check whether a token was revoked?
Not by default. The verify page says the check does not cover revocation, and that checkRevoked must be passed to check it. (Firebase: Verify ID tokens)
Is auth/id-token-expired the same as auth/session-cookie-expired?
No. The Admin errors page lists them as separate codes with separate messages. (Firebase: Admin SDK errors)
Can VibeFix fix it for me?
Yes, for apps built in Lovable or any app whose code is on GitHub. The free check confirms the problem on your live app first. If you want it fixed, our AI agent finds the cause, fixes it in your code for $79 and tests your live app again. See pricing.
Related guides
- Firebase auth: unauthorized domain
- Firebase Google sign-in not working: enable the provider
- Lovable login loop: why you keep returning to sign-in
Sources
- Firebase: Admin SDK errors
- Firebase: Verify ID tokens
- Firebase: Manage sessions
- Firebase JS SDK reference: User
- Firebase JS SDK: errors.ts
Last checked: 17 November 2026.
VibeFix is independent. Firebase is a trademark of its owner.
More guides · Shopify store accessibility · About · Your privacy choices