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

feat: Android: Remove isTokenAutoRefreshEnabled from initialize method of FirebaseAppCheck.java #480

Closed
1 of 9 tasks
DaveRicho opened this issue Oct 28, 2023 · 2 comments
Closed
1 of 9 tasks

Comments

@DaveRicho
Copy link

Plugin(s)

  • Analytics
  • App
  • App Check
  • Authentication
  • Crashlytics
  • Cloud Firestore
  • Cloud Messaging
  • Performance
  • Remote Config

Current problem

Hi @robingenz,

You may already be on top of this (and perhaps I should attempt a pull request - but I'm still pretty new to this stuff and don't want to waste anyone's time), but I had some issues with App Check android (web and ios are perfect).

After thinking I had something wrong with my SHA256 keys (for days!), I think I found the issue. I read, re-read and then re-read this page another 20 times https://firebase.google.com/docs/app-check/android/play-integrity-provider.

Finally I realised that (this might only apply for com.google.firebase:firebase-appcheck-playintegrity:17.1.1 and perhaps not for the current project's 17.0.1) that in the initializeApp step, that they look to have dropped isTokenAutoRefreshEnabled.

So that these mods to FirebaseAppcheck.java seem to resolve my problem (at least when I use 17.1.1):

public void initialize(boolean debug, boolean isTokenAutoRefreshEnabled) {
        if (debug) {
            this.appCheckInstance.installAppCheckProviderFactory(DebugAppCheckProviderFactory.getInstance(), isTokenAutoRefreshEnabled);
        } else {
            this.appCheckInstance.installAppCheckProviderFactory(                    
//                    PlayIntegrityAppCheckProviderFactory.getInstance(),
//                    isTokenAutoRefreshEnabled
                      PlayIntegrityAppCheckProviderFactory.getInstance()
                );
        }
    }

Preferred solution

Remove isTokenAutoRefreshEnabled from FirebaseAppCheck.java so the initialize method looks like:

public void initialize(boolean debug, boolean isTokenAutoRefreshEnabled) {
        if (debug) {
            this.appCheckInstance.installAppCheckProviderFactory(DebugAppCheckProviderFactory.getInstance(), isTokenAutoRefreshEnabled);
        } else {
            this.appCheckInstance.installAppCheckProviderFactory(
                    PlayIntegrityAppCheckProviderFactory.getInstance()
                );
        }
    }

Alternative options

No response

Additional context

Thanks so much for your hard work on this App you legend @robingenz and apologies if I have wasted anyone's time here.

@robingenz
Copy link
Member

Thank you for your request!

but I had some issues with App Check android (web and ios are perfect).

Unfortunately, that is not a sufficient description of your problem for me to be able to help you.

Finally I realised that (this might only apply for com.google.firebase:firebase-appcheck-playintegrity:17.1.1 and perhaps not for the current project's 17.0.1) that in the initializeApp step, that they look to have dropped isTokenAutoRefreshEnabled.

I don't think so since this would be a breaking change in a minor/patch release. The method also still exists in the documentation: https://firebase.google.com/docs/reference/android/com/google/firebase/appcheck/FirebaseAppCheck#installAppCheckProviderFactory(com.google.firebase.appcheck.AppCheckProviderFactory,boolean)
For this reason i am closing this issue.

Feel free to update this issue if you find out anything new.

@robingenz robingenz closed this as not planned Won't fix, can't repro, duplicate, stale Oct 29, 2023
@DaveRicho
Copy link
Author

Sorry @robingenz, I think I've got some other problem anyway with PlayIntegrityAppCheckProviderFactory.

I've had to resort going back to the deprecated

this.appCheckInstance.installAppCheckProviderFactory(
                    SafetyNetAppCheckProviderFactory.getInstance()
            );

to get our production app working for now....

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants