Skip to content

App Check - Too many attempts #6753

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
3 of 10 tasks
chenop opened this issue Dec 1, 2022 · 16 comments
Closed
3 of 10 tasks

App Check - Too many attempts #6753

chenop opened this issue Dec 1, 2022 · 16 comments
Labels
help: needs-triage Issue needs additional investigation/triaging. type: bug New bug report

Comments

@chenop
Copy link

chenop commented Dec 1, 2022

Issue

Trying to use AppCheck with "Play Integrity" android
Did the following:

  1. install react-native-firebase/app-check
  2. In Firebase Console --> App Check --> Apps --> Registered Successfully Play Integrity - inserting the SHA-256 generated from the app keystore file
    keytool -list -v -alias [alias] -keystore [keystore file path] -keypass [key password]
  3. invoking:
export const getAppCheckToken = async () => {
	try {
		const { token } = await firebase.appCheck().getToken();
		return token;
	} catch (err) {
		console.error(err);
		return err.toString();
	}
};

Actual:
[appCheck/token-error] com.google.firebase.FirebaseException: Too many attempts

Expected:
Real token


Project Files

Javascript

Click To Expand

package.json:

    "@react-native-firebase/analytics": "14.12.0",
    "@react-native-firebase/app": "14.12.0",
    "@react-native-firebase/app-check": "14.12.0",
    "@react-native-firebase/crashlytics": "14.12.0",
    "@react-native-firebase/dynamic-links": "14.12.0",
    "@react-native-firebase/perf": "14.12.0",

firebase.json for react-native-firebase v6:

# N/A

iOS

Click To Expand

ios/Podfile:

  • I'm not using Pods
  • I'm using Pods and my Podfile looks like:
# N/A

AppDelegate.m:

// N/A


Android

Click To Expand

Have you converted to AndroidX?

  • my application is an AndroidX application?
  • I am using android/gradle.settings jetifier=true for Android compatibility?
  • I am using the NPM package jetifier for react-native compatibility?

android/build.gradle:

// N/A

android/app/build.gradle:

// N/A

android/settings.gradle:

// N/A

MainApplication.java:

// N/A

AndroidManifest.xml:

<!-- N/A -->


Environment

Click To Expand

react-native info output:

 OUTPUT GOES HERE
  • Platform that you're experiencing the issue on:
    • iOS
    • Android
    • iOS but have not tested behavior on Android
    • Android but have not tested behavior on iOS
    • Both
  • react-native-firebase version you're using that has this issue:
    • e.g. 5.4.3
  • Firebase module(s) you're using that has the issue:
    • e.g. Instance ID
  • Are you using TypeScript?
    • Y/N & VERSION


@chenop chenop added help: needs-triage Issue needs additional investigation/triaging. type: bug New bug report labels Dec 1, 2022
@mikehardy
Copy link
Collaborator

    "@react-native-firebase/analytics": "14.12.0",
    "@react-native-firebase/app": "14.12.0",
    "@react-native-firebase/app-check": "14.12.0",
    "@react-native-firebase/crashlytics": "14.12.0",
    "@react-native-firebase/dynamic-links": "14.12.0",
    "@react-native-firebase/perf": "14.12.0",

Please only log issues against current stable versions. Update to current stable then report if you still reproduce

[appCheck/token-error] com.google.firebase.FirebaseException: Too many attempts

How many attempts were there 🤔 ? We test it in our CI all the time and it definitely works - I suspect something about your project config and/or timing of requests etc. You should watch adb logcat while testing.

@chenop
Copy link
Author

chenop commented Dec 1, 2022

Thank you @mikehardy for the quick response - will try to upgrade those packages

@chenop
Copy link
Author

chenop commented Dec 4, 2022

Hi @mikehardy - Updated to latest version:

    "@react-native-firebase/analytics": "16.4.6",
    "@react-native-firebase/app": "^16.4.6",
    "@react-native-firebase/app-check": "^16.4.6",
    "@react-native-firebase/crashlytics": "^16.4.6",
    "@react-native-firebase/dynamic-links": "^16.4.6",
    "@react-native-firebase/perf": "^16.4.6",
    "react-native": "0.66.4",

Still got "too many attempts"

adb logcat:

2022-12-04 16:41:34.186 7174-7358/? E/AppCheck: RNFB: Unknown error while fetching AppCheck token com.google.firebase.FirebaseException: No AppCheckProvider installed.
2022-12-04 16:41:34.187 7174-7280/? E/ReactNativeJS: [Error: [appCheck/token-error] com.google.firebase.FirebaseException: No AppCheckProvider installed.]
2022-12-04 16:41:34.233 7174-7281/? E/unknown:ReactNative: Error: [appCheck/token-error] com.google.firebase.FirebaseException: No AppCheckProvider installed., js engine: hermes, stack:
    getToken@1:1846223
    _callee$@1:1844795
    tryCatch@1:203176
    invoke@1:204180
    anonymous@1:203324
    tryCatch@1:203176
    invoke@1:203409
    anonymous@1:203848
    tryCallTwo@61:8
2022-12-04 16:41:37.488 7174-7358/? E/AppCheck: RNFB: Unknown error while fetching AppCheck token com.google.firebase.FirebaseException: Error returned from API. code: 403 body: App attestation failed.
2022-12-04 16:41:37.489 7174-7358/? E/AppCheck: RNFB: Unknown error while fetching AppCheck token com.google.firebase.FirebaseException: Too many attempts.
2022-12-04 16:41:37.490 7174-7280/? I/ReactNativeJS: { token: 'Error: [appCheck/token-error] com.google.firebase.FirebaseException: Error returned from API. code: 403 body: App attestation failed.' }
2022-12-04 16:41:37.519 7174-7280/? E/ReactNativeJS: [Error: [appCheck/token-error] com.google.firebase.FirebaseException: Error returned from API. code: 403 body: App attestation failed.]
2022-12-04 16:41:37.520 7174-7280/? E/ReactNativeJS: [Error: [appCheck/token-error] com.google.firebase.FirebaseException: Too many attempts.]
2022-12-04 16:41:37.526 7174-7281/? E/unknown:ReactNative: Error: [appCheck/token-error] com.google.firebase.FirebaseException: Error returned from API. code: 403 body: App attestation failed., js engine: hermes, stack:
    getToken@1:1846223
    _callee$@1:1844795
    tryCatch@1:203176
    invoke@1:204180
    anonymous@1:203324
    tryCatch@1:203176
    invoke@1:203409
    anonymous@1:203848
    tryCallTwo@61:8
2022-12-04 16:41:37.529 7174-7281/? E/unknown:ReactNative: Error: [appCheck/token-error] com.google.firebase.FirebaseException: Too many attempts., js engine: hermes, stack:
    getToken@1:1846223
    _callee$@1:1844795
    tryCatch@1:203176
    invoke@1:204180
    anonymous@1:203324
    tryCatch@1:203176
    invoke@1:203409
    anonymous@1:203848
    tryCallTwo@61:8

@chenop
Copy link
Author

chenop commented Dec 4, 2022

App Check on Android looks ok
image

Took the SAH-256 from here:
image

@mikehardy Is that ok?

@mikehardy
Copy link
Collaborator

Trying to use AppCheck with "Play Integrity" android

We don't support Play Integrity yet.

So I think this is essentially duplicate #6434

@mptorz
Copy link

mptorz commented Jun 12, 2023

Hey, I'm having exactly the same issues with latest react-native-firebase.

@IncognitoGK9
Copy link

IncognitoGK9 commented Jul 1, 2023

I also have similar issue: I have followed all steps, put the debug tokens where necessary. I want to use firebase emulator with real device. This works perfect with web but with mobile app on real device hitting the firebase emulator, has error:
D/com.google.firebase.appcheck.debug.internal.DebugAppCheckProvider(25557): Enter this debug secret into the allow list in the Firebase Console for your project: 36c2eb3f-ed60-4d36-b2a8-137d45******
W/LocalRequestInterceptor(25557): Error getting App Check token; using placeholder token instead. Error: com.google.firebase.FirebaseException: Too many attempts.

Note that the debug secret is already in the firebase as required.

Is there a clear step by step procedure for setting up firebase emulator with App check, I have failed to get this straight...

And with the live (non emulator, after configuring App check, App intergrity, My app stopped getting downloads. I have set the configuration to :

MEETS_BASIC_INTEGRITY (this is deselected)
The app is running on a device that passes basic system integrity checks. Learn more

MEETS_STRONG_INTEGRITY (this is deselected)
The app is running on an Android device powered by Google Play services. It has a strong guarantee of system integrity. Learn more

all the necessary configuration on the code side have been done, but Google play keeps showing the Safetynet warning, and still since this configuration, seems my app is no longer visible to users thus no more downloads....
on the Google Cloud part, I disabled or do not have any key restriction for firebase: Android key (auto created by Firebase) because such restrictions were affecting my app (but still, this app check integrity issues persists.... there is clearly a confusion on App check, App integrity, firebase emulator vs Firebase, web vs mobile use for firebase emulator/firebase live....

I wish someone will do a comprehensive guide on these set ups.

@barath-dev
Copy link

I am developing a flutter application and facing the exact same issue
Error getting App Check token; using placeholder token instead. Error: com.google.firebase.FirebaseException: Error returned from API. code: 403 body: App attestation failed.
I wish someone to help me resolve this error

@VidojeMuric
Copy link

I am developping Android application and having same issues. Could someone give his experience, how to resolve these issues?

Error getting App Check token; using placeholder token instead. Error: com.google.firebase.FirebaseException: Error returned from API. code: 403 body: App attestation failed.

Error getting App Check token; using placeholder token instead. Error: com.google.firebase.FirebaseException: Too many attempts.

@barath-dev
Copy link

Hey VidojeMuric,
I haven't resolved this issue but, i de enforced in the Firebase app
check.I dont think
there is a exact solution for this, I have tried every way possible to
completely
resolve this issue. So ignoring this issue would be the best solution.

@Krishi1702
Copy link

Hey @VidojeMuric
I am getting the same error. Did you find any solution to it?

@Abdelsattar
Copy link

Abdelsattar commented Feb 20, 2025

I face the same issue, any solution found?

@ottob
Copy link

ottob commented Mar 13, 2025

We also see this issue in production on android devices.

@gongshoudao
Copy link

Same issue~~~~

@Lambda-tron
Copy link

same issuee [firebase_app_check/unknown] com.google.firebase.FirebaseException: Too many attempts.

@pcevikogullari
Copy link

Same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help: needs-triage Issue needs additional investigation/triaging. type: bug New bug report
Projects
None yet
Development

No branches or pull requests