Skip to content

Firebase appcheck token verification fails because the sdk can't retrieve JWKS #2913

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
robojiannis opened this issue May 7, 2025 · 5 comments

Comments

@robojiannis
Copy link

  • Operating System version: osx
  • Firebase SDK version: "firebase-admin": "^11.9.0", "firebase-functions": "^3.21.0",
  • Firebase Product: appcheck
  • Node.js version: 20
  • NPM version: 10.8

calling this:
const decodedToken = await configs.admin.auth().verifyIdToken(idToken);
const uid = decodedToken?.uid;

returns this error:
Failed to validate AppCheck token. FirebaseAppCheckError: Error fetching Json Web Keys: socket hang up
at AppCheckTokenVerifier.mapJwtErrorToAppCheckError (/layers/google.nodejs.yarn/yarn_modules/node_modules/firebase-admin/lib/app-check/token-verifier.js:144:16)
at /layers/google.nodejs.yarn/yarn_modules/node_modules/firebase-admin/lib/app-check/token-verifier.js:119:24
at async checkAppCheckToken (/layers/google.nodejs.yarn/yarn_modules/node_modules/firebase-functions/lib/common/providers/https.js:355:28)
at async /layers/google.nodejs.yarn/yarn_modules/node_modules/firebase-functions/lib/common/providers/https.js:283:33
at async Promise.all (index 1)
at async checkTokens (/layers/google.nodejs.yarn/yarn_modules/node_modules/firebase-

This started happening in the last 2-3 hours.

@google-oss-bot
Copy link

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

@mina4gerges
Copy link

mina4gerges commented May 7, 2025

working now

@RikkOmsk
Copy link

RikkOmsk commented May 7, 2025

+1
nhandled error FirebaseAuthError: Error while making request: . at FirebaseTokenVerifier.mapJwtErrorToAuthError (/workspace/node_modules/firebase-admin/lib/auth/token-verifier.js:283:16) at /workspace/node_modules/firebase-admin/lib/auth/token-verifier.js:255:24 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async /workspace/node_modules/firebase-functions/lib/common/providers/identity.js:454:23 { errorInfo: { code: 'auth/argument-error', message: 'Error while making request: .' }, codePrefix: 'auth' }

After 15 min - working

@robojiannis
Copy link
Author

yip, it's back online for me too. It was offline 5-6 hours in total

@lahirumaramba
Copy link
Member

Hey folks, glad to hear that this issue is resolved now.
@robojiannis I am curious, the code you shared uses the Auth API not Appcheck, could you share more details on that?

const decodedToken = await configs.admin.auth().verifyIdToken(idToken);
const uid = decodedToken?.uid;

auth().verifyIdToken shouldn't throw errors from the App Check API. I am curious to see if there is an unintended call chain that is somehow integrated with the App Check token verification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants