Skip to content

Conversation

@shubham1g5
Copy link
Contributor

Product Description/

https://dimagi.atlassian.net/browse/CI-115

Technical Summary

Noticing a few Firebase logs that implies that the integrity token provider is getting stale and we need to re-prepare in response for this error

Failure Logs:

 Non-fatal Exception: com.google.android.play.core.integrity.StandardIntegrityException: -19: Standard Integrity API error (-19): The StandardIntegrityTokenProvider is invalid (e.g. it is outdated).
Request a new integrity token provider by calling StandardIntegrityManager#prepareIntegrityToken. (https://developer.android.com/google/play/integrity/reference/com/google/android/play/core/integrity/model/StandardIntegrityErrorCode.html#INTEGRITY_TOKEN_PROVIDER_INVALID).

There are no details available in Google docs around why and when the token provider goes invalid, searching around the internet it seems like the behavior can vary device to device quite greatly and it's possible for the provider to go invalid in a matter of seconds.

Labels and Review

  • Do we need to enhance the manual QA test coverage ? If yes, the "QA Note" label is set correctly
  • Does the PR introduce any major changes worth communicating ? If yes, the "Release Note" label is set and a "Release Note" is specified in PR description.
  • Risk label is set correctly
  • The set of people pinged as reviewers is appropriate for the level of risk of the change

@shubham1g5 shubham1g5 marked this pull request as ready for review June 24, 2025 10:44
callback: IntegrityTokenCallback,
hasRetried: Boolean
) {
if (exception is StandardIntegrityException && exception.errorCode == -19 && !hasRetried) {
Copy link
Contributor

@Jignesh-dimagi Jignesh-dimagi Jun 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shubham1g5 Google doc says same retry for error code =-18 also, not sure if we want to handle that case too.

Also, if we can compare like exception.errorCode ==INTEGRITY_TOKEN_PROVIDER_INVALID

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, this prompted me to handle other common error codes as well and provide more dintinctive error messages, please have a look again.

callback: IntegrityTokenCallback,
hasRetried: Boolean
) {
if (exception is StandardIntegrityException && exception.errorCode == -19 && !hasRetried) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just for my reference want to know from where -19 is coming is there any doc related to this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

look at the failure logs attached in the PR description

@Jignesh-dimagi
Copy link
Contributor

@shubham1g5 Changes looks good to me. Just small thing if we can put some logger here also

@shubham1g5
Copy link
Contributor Author

@Jignesh-dimagi good catch, added here

@shubham1g5 shubham1g5 merged commit 9e4821a into june_beta_hotfix Jun 25, 2025
1 check passed
@shubham1g5 shubham1g5 deleted the tokenProviderFix branch June 25, 2025 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants