I'm using Firebase AppCheck to authenticate that calls to my API are indeed coming from my app.
My issue is that ever since I enabled AppCheck, I can only get a token on legit devices or via debug tokens for the emulator. In a way this makes sense, but being unable to take advantage of Pre-Launch Reports is a pretty big caveat since they come in handy to ensure I don't ship a bugged version to my testers. Neither Pre-Launch Reports nor the Firebase Test Lab seem to have a way to pass SafetyNet.
Are all apps that use SafetyNet just unable to use Pre-Launch Reports or the Firebase Test Lab? That seems rather implausible to me, which is why I assume I'm missing something here.
Relevant code:
app/build.gradle
:
dependencies {
implementation platform('com.google.firebase:firebase-bom:29.3.1')
implementation 'com.google.firebase:firebase-crashlytics-ktx'
implementation 'com.google.firebase:firebase-analytics-ktx'
implementation 'com.google.firebase:firebase-appcheck-safetynet:16.0.0-beta06'
implementation 'com.google.firebase:firebase-appcheck-debug:16.0.0-beta06'
// ...
}
In the onCreate()
method of my Application
class:
// ...
FirebaseApp.initializeApp(this)
val appCheck = FirebaseAppCheck.getInstance()
appCheck.installAppCheckProviderFactory(
if (!BuildConfig.DEBUG) {
SafetyNetAppCheckProviderFactory.getInstance()
} else {
Log.i(javaClass.name, "Using debug version of AppCheck.")
DebugAppCheckProviderFactory.getInstance()
}
)
// ...