firebase / firebase/firebase-android-sdk
FirebaseAppCheck.getAppCheckToken(true) does not appear to force refresh all the time?
- Dominant language
- Java
- Stars
- 2.6k
- Forks
- 710
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 31
Description
### [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](http://stackoverflow.com/)
with the firebase tag.
* For general Firebase discussion, use the [firebase-talk](https://groups.google.com/forum/#!forum/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](https://firebase.google.com/support/).
### [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? :thinking:
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/master/tests/README.md)
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 https://github.com/firebase/firebase-ios-sdk/issues/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!
Contributor guide
Assessment
This issue has not been assessed yet.