-
Couldn't load subscription status.
- Fork 1.1k
Closed
Description
[REQUIRED] Environment info
firebase-tools: 9.16.3 (Works OK in 9.16.0)
Platform: Ubuntu
[REQUIRED] Test case
- Generate user with a token
- Verify token in functions
[REQUIRED] Steps to reproduce
- Run local emulator
- Create a user/token (e.g. integration test)
await firebase.auth().createUserWithEmailAndPassword(email, password)
const userCredential = await firebase.auth().signInWithEmailAndPassword(email, password)
const idToken = await userCredential.user.getIdToken(true)- Use this token to make a call (e.g. integration test) to a local function that verifies the token, e.g.:
await axios.get(
`http://localhost:5001/project-id/us-central1${path}`,
{
headers: { "Authorization": `Bearer ${user.idToken}` }
}
)- Verify token on the function side:
const decodedIdToken = await admin.auth().verifyIdToken(idToken);
- Observe an error thrown:
{"severity":"ERROR","message":"Error while verifying Firebase ID token: FirebaseAuthError: The Firebase ID token has been revoked.
at FirebaseAuthError.FirebaseError [as constructor] (/Users/vagrant/git/firebase/functions/node_modules/firebase-admin/lib/utils/error.js:44:28)
at FirebaseAuthError.PrefixedFirebaseError [as constructor] (/Users/vagrant/git/firebase/functions/node_modules/firebase-admin/lib/utils/error.js:90:28)
at new FirebaseAuthError (/Users/vagrant/git/firebase/functions/node_modules/firebase-admin/lib/utils/error.js:149:16)\n at /Users/vagrant/git/firebase/functions/node_modules/firebase-admin/lib/auth/auth.js:675:27
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async Object.validateFirebaseIdToken (/Users/vagrant/git/firebase/functions/lib/utils.js:101:32)\n at async /Users/vagrant/git/firebase/functions/lib/index.js:124:18
at async runFunction (/Users/vagrant/.nvm/versions/node/v14.17.5/lib/node_modules/firebase-tools/lib/emulator/functionsEmulatorRuntime.js:614:9)
at async runHTTPS (/Users/vagrant/.nvm/versions/node/v14.17.5/lib/node_modules/firebase-tools/lib/emulator/functionsEmulatorRuntime.js:634:5)
at async handler (/Users/vagrant/.nvm/versions/node/v14.17.5/lib/node_modules/firebase-tools/lib/emulator/functionsEmulatorRuntime.js:563:17) {
errorInfo: {
code: 'auth/id-token-revoked',
message: 'The Firebase ID token has been revoked.'
},
codePrefix: 'auth'
}"}[REQUIRED] Expected behavior
Token is verified correctly
[REQUIRED] Actual behavior
An error is thrown during verification
Metadata
Metadata
Assignees
Labels
No labels