Skip to content
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

Phone Auth with Firebase App Check Debug Provider #2139

Open
ArcherEmiya05 opened this issue Sep 1, 2023 · 1 comment
Open

Phone Auth with Firebase App Check Debug Provider #2139

ArcherEmiya05 opened this issue Sep 1, 2023 · 1 comment
Assignees

Comments

@ArcherEmiya05
Copy link

ArcherEmiya05 commented Sep 1, 2023

Welcome to FirebaseUI and thanks for submitting an issue!

Please take a look at open issues, as well as resolved issues, to see if your issue is either already being addressed, or has been solved by someone else.

If not, please feel free to fill in the following info so we can help faster!

Step 1: Are you in the right place?

  • For issues or feature requests related to the code in this repository file a GitHub issue.
  • For general technical questions, post a question on StackOverflow tagged appropriately.
  • For general Firebase discussion, use the firebase-talk google group
  • For help troubleshooting your application that does not fall under one of the above categories, reach out to the personalized Firebase support channel

Step 2: Describe your environment

  • Android device: Emulator and Physical
  • Android OS version: 5.0 and above
  • Google Play Services version: 4.3.15
  • Firebase/Play Services SDK version: 22.1.1
  • FirebaseUI version: 8.0.2

Step 3: Describe the problem:

Steps to reproduce:

  1. Use Firebase Phone Auth
  2. Setup project with Firebase App Check
  3. Run the app in both emulator or physical device

Observed Results:

Failed to work with unknown error occurred message.

Expected Results:

How to work with Firebase App Check Play Integrity Debug Provider since Firebase Phone Auth now is no longer working with deprecated SafetyNet?

Relevant Code:

Error logs:

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.


[SmsRetrieverHelper] SMS verification code request failed: unknown status code: 18002 Invalid PlayIntegrity token; app not Recognized by Play Store.


SMS verification code request failed: unknown status code: 17093 null

com.google.firebase.auth.FirebaseAuthException: This request is missing a valid app identifier, meaning that Play Integrity checks, and reCAPTCHA checks were unsuccessful. Please try again, or check the logcat for more details.

We already generated a debug token App Check in console, already added both debug and release SHA 256 under Play Integrity. Then we add this codes:

build.gradle

   defaultConfig {
      testInstrumentationRunnerArguments["firebaseAppCheckDebugSecret"] = "DEBUG_TOKEN"
   }



    api 'com.google.firebase:firebase-appcheck-playintegrity:17.0.1'
    api 'com.google.firebase:firebase-appcheck-debug:17.0.1'
    api 'com.google.firebase:firebase-appcheck-ktx:17.0.1'
    api 'com.google.android.play:integrity:1.2.0'

    api 'com.google.firebase:firebase-appcheck-debug-testing:17.0.1'

Application.kt

       FirebaseApp.initializeApp(this)

        debugAppCheckTestHelper.withDebugProvider {
            // Test code that requires a debug AppCheckToken.
        }

        Firebase.analytics.setAnalyticsCollectionEnabled(BuildConfig.DEBUG.not())
        Firebase.crashlytics.setCrashlyticsCollectionEnabled(BuildConfig.DEBUG.not())
        Firebase.messaging.subscribeToTopic(AppConfig.FCM_TOPIC_ANNOUNCEMENT)

        Firebase.appCheck.installAppCheckProviderFactory(
            if (BuildConfig.DEBUG)
                DebugAppCheckProviderFactory.getInstance()
            else
                PlayIntegrityAppCheckProviderFactory.getInstance()
        )

Currently we are stuck since we do not know how to let Firebase UI's Firebase Auth know that we are using Debug Token

@thatfiredev thatfiredev self-assigned this Oct 6, 2023
@arjun42squar
Copy link

I also faced this issue. This error log denotes that reCAPTCHA failed in the process, This can be solved by changing your default browser to another option or clearing the data of your available browser, My issue was solved when changed to Chrome.
Still, this is not a best practice. Play Integrity only works if we download the app from the Play Store so I'm waiting to do it when the app is published in Play Store

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

No branches or pull requests

3 participants