Skip to content

fix(auth): align Android blocking function error code with Apple platforms - #18874

Open
k-nkmr wants to merge 5 commits into
firebase:mainfrom
k-nkmr:fix/auth-blocking-function-error-code
Open

k-nkmr wants to merge 5 commits into
firebase:mainfrom
k-nkmr:fix/auth-blocking-function-error-code

Conversation

@k-nkmr

@k-nkmr k-nkmr commented Oct 27, 2026 •

Copy link
Copy Markdown

Description

When an authentication blocking function rejects an operation,
FirebaseAuthException.code differs between Android and Apple platforms:

  • Android: blocking-function-error-response
  • Apple: blocking-cloud-function-returned-error

This change maps Android's BLOCKING_FUNCTION_ERROR_RESPONSE marker to
blocking-cloud-function-returned-error, allowing apps to handle this
error with the same code on Android and Apple platforms.

The existing invalid-login-credentials mapping is preserved. The error
code reference and platform differences table are updated accordingly.

Validation

  • Updated the existing blocking function test to expect the shared code
    while preserving the JSON error message.
  • Added tests for detection from Pigeon details and for preserving
    invalid-login-credentials.
  • All 213 tests in firebase_auth_platform_interface pass.
  • All Firebase Auth packages pass analysis.
  • Workspace analysis (dart run melos run analyze-ci) passes for 59 of
    61 packages. firebase_ai and firebase_ai_example fail because the
    local firebase_options.dart configuration file is missing. These
    failures are unrelated to this change.
  • Formatting checks pass for both changed Dart files.
  • Device integration testing has not been performed.

Related Issues

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • My PR includes unit or integration tests for all changed/updated/fixed behaviors (See Contributor Guide).
  • All existing and new tests are passing.
  • I updated/added relevant documentation (doc comments with ///).
  • The analyzer (melos run analyze) does not report any problems on my PR.
  • I read and followed the Flutter Style Guide.
  • I signed the CLA.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

  • Yes, this is a breaking change.
  • No, this is not a breaking change.

On Android, apps that check for blocking-function-error-response must
update that check to blocking-cloud-function-returned-error.

@google-cla

google-cla Bot commented Oct 27, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request normalizes the error code returned on Android for blocking function errors to match the Apple platform error code ('blocking-cloud-function-returned-error'), updating the documentation, exception handling logic, and tests. The review feedback suggests declaring the 'recognizedCodes' map as 'const' instead of 'final' to avoid allocating a new map on every invocation of '_getCustomCode'.

@k-nkmr
k-nkmr marked this pull request as ready for review October 27, 2026 11:44

@SelaseKay SelaseKay left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi @k-nkmr, thanks for the PR. Could you add an e2e test for this?

@k-nkmr

k-nkmr commented Oct 28, 2026

Copy link
Copy Markdown
Author

@SelaseKay
Added an e2e test for blocking function errors in 9f8eeee. Thanks for the review!

@k-nkmr
k-nkmr requested a review from SelaseKay October 28, 2026 11:05

This branch has not been deployed

No deployments
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.

2 participants