3

I cannot get Firebase AppCheck to work in production mode on a Vue.js project with Firestore and Storage. But It works normally in development.

const appCheck: AppCheck = initializeAppCheck(firebaseApp, {
  provider: new ReCaptchaV3Provider(reCaptchaSiteKey),
  isTokenAutoRefreshEnabled: true,
});

getToken(appCheck)
  .then((result: AppCheckTokenResult) => {
    console.log(process.env.NODE_ENV);
    console.log(result.token);
  })
  .catch((e: FirebaseError) => {
    console.log(process.env.NODE_ENV);
    console.log(e.code + ": " + e.message);
  });

In Development mode, using vite, get the token back: In Development mode

In Production mode, with firebase serve, get appCheck/fecth-status-error: enter image description here

Dharmaraj
  • 47,845
  • 8
  • 52
  • 84
Fei Whang
  • 209
  • 4
  • 11

1 Answers1

-1

Firebaser here!

The error you are receiving is due to the App Check backend not being able to verify the underlying reCAPTCHA attestation.

Things to check for:

  • is reCAPTCHA providing a valid attestation and not somehow thinking your device is a bot?
  • does the site secret uploaded to App Check for this App match the client ID you are using in the App?

If you are using a Debug Token in your development build, that might explain why that one is succeeding.

  • 1
    This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/31846529) – Samball May 27 '22 at 10:04