Skip to content

FirebaseAppCheck.getAppCheckToken(true) does not appear to force refresh all the time? #2954

Open
@mikehardy

Description

@mikehardy

[READ] Step 1: Are you in the right place?

Issues filed here should be about bugs in the code in this repository.
If you have a general question, need help debugging, or fall into some
other category use one of these other channels:

  • For general technical questions, post a question on StackOverflow
    with the firebase tag.
  • 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.

[REQUIRED] Step 2: Describe your environment

  • Android Studio version: 7.0.2
  • Firebase Component: AppCheck
  • Component version: from BoM 28.4.0

[REQUIRED] Step 3: Describe the problem

Steps to reproduce:

If you call these two methods back to back the tokens are equal in certain cases. Is that expected? Shouldn't force refreshing the token always get a new token? 🤔

pseudo-code:

token1 = FirebaseAppCheck.getAppCheckToken();`
token2 = FirebaseAppCheck.getAppCheckToken(true);

// sometimes token1 == token2?
// But then if you wait 5 seconds and re-try both back to back you will get token1 != token2 

Relevant Code:

We test this case here, you can run it

https://github.com/invertase/react-native-firebase/blob/90b4d7021aff7d5d28140b57eb69283b04712257/packages/app-check/e2e/appcheck.e2e.js#L54-L65

The (boring, by the book) Java code it exercises is:

https://github.com/invertase/react-native-firebase/blob/90b4d7021aff7d5d28140b57eb69283b04712257/packages/app-check/android/src/main/java/io/invertase/firebase/appcheck/ReactNativeFirebaseAppCheckModule.java#L73-L95

This same test found an actual crash in the firebase-ios-sdk which was just resolved firebase/firebase-ios-sdk#8544 - so perhaps this is just an unexpected (though still valid) use case?

Or perhaps my expectations of the API are incorrect?

Any insight appreciated - thanks!

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions