iosswiftapp-store-connectfirebase-app-check

Firebase App Check / App Attest Internal Error -iOS


When using Xcode, and running my app, I'm able to access Firebase via App Check / App Attest doing the following:

let providerFactory = AppCheckDebugProviderFactory()
AppCheck.setAppCheckProviderFactory(providerFactory)

Once I get the Firebase App Check debug token. I manually add the token to Firebase Console > App Check

But when I uploaded my app to App Review, they can't login, they get an error code of

17999 - Internal Error

Why is it Firebase via App Check / App Attest, Firebase isn't accessible in production/going live?

I took the following steps:

I updated to the most recent pods.

In Firebase Console:

App Check > Apps > AppAttest > Registered and added my Team ID. Token time to live set to 1 hour (default) > Save

In AppDelegate:

import FirebaseAppCheck

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    override init() {
        super.init()
        
        Messaging.messaging().delegate = self
        
        let providerFactory = YourAppCheckProviderFactory()
        AppCheck.setAppCheckProviderFactory(providerFactory)
        
        FirebaseApp.configure()
    }
}

class YourAppCheckProviderFactory: NSObject, AppCheckProviderFactory {
  func createProvider(with app: FirebaseApp) -> AppCheckProvider? {
    return AppAttestProvider(app: app)
  }
}

In Xcode:

Edit Schemes > Run > Arguments > FIRDebugEnabled is checked

Downloaded the most recent Google-Info.plist from Firebase Console > Project Overview > Project Settings > General > Apple apps > Replaced the previous one in my project with the most recent one

Targets > Signing & Capabilities > added App Attest

In the Entitlements File > App Attest Environment : production

In Google Cloud Console:

Credentials > Key Restrictions : None > API restrictions : Don't restrict keys

APIs & Services > Library > Token Service API: enabled

In developer.apple.com:

Certificates, IDs & Profiles > Certificates > Keys > created a Device Check key

Images (for other people who may come across this issue):

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here


Solution

  • This problem occurred because my Firebase pods were outdated. They were on 8.15.0 when they should've been on the current version which is 10.17.0.

    To check you pod version go to your app's main folder, open terminal, cd to it, and run open -a TextEdit Podfile.lock or vim Podfile.lock and check your firebase pod version. To update run pod outdated then pod update