Reuse Debug AppCheck token in iOS Simulator

230 views Asked by At

I finished my ios app and now i want to implement appCheck on it. The problem is that when i'm running this in the simulator / real device but in debug mode, the token changes (not always, but sometimes) and i have to update the "debug tokens" from firebase console.

How can i reuse the tokens?

I find it hard to believe that i have to do these steps every time it changes, it's annoying.

I tried setting it up as here, not working enter image description here

1

There are 1 answers

0
ALex On BEST ANSWER

Found the solution here.

In case the link doesn't work:

In edit scheme -> env variables set FIRAAppCheckDebugToken with a debug token

In <project name>.entitlements App Attest Environment = production

and in your app delegate or where you initialise your firebase code

        
#if targetEnvironment (simulator)
        let providerFactory = AppCheckDebugProviderFactory()
        AppCheck.setAppCheckProviderFactory(providerFactory)
#else
        let providerFactory = CustomAppCheckProviderFactory()
        AppCheck.setAppCheckProviderFactory(providerFactory)
#endif
        
        FirebaseApp.configure()