Skip to content

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

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

k-nkmr wants to merge 4 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
@SelaseKay SelaseKay added the blocked: do-not-merge PR blocked externally label Nov 24, 2026
@SelaseKay

Copy link
Copy Markdown
Contributor

Hi @k-nkmr, kindly rebase with main and push changes.

@k-nkmr
k-nkmr force-pushed the fix/auth-blocking-function-error-code branch from d8f0b61 to d58d416 Compare November 25, 2026 05:51
@k-nkmr

k-nkmr commented Nov 25, 2026

Copy link
Copy Markdown
Author

@SelaseKay
Thanks! Rebased onto main and pushed.

@SelaseKay

Copy link
Copy Markdown
Contributor

@k-nkmr, CLA check is failing. Could you sign that?

@k-nkmr
k-nkmr force-pushed the fix/auth-blocking-function-error-code branch from d58d416 to b68991e Compare November 25, 2026 06:29
@k-nkmr

k-nkmr commented Nov 25, 2026

Copy link
Copy Markdown
Author

@SelaseKay

Already signed. One commit had a "Co-Authored-By: Claude" line, which tripped the CLA check. Removed it, and it's passing now.

@SelaseKay

Copy link
Copy Markdown
Contributor

Hi @k-nkmr, we'd have to close this PR unfortunately. #18020 was the casing mismatch, and #18056 already fixed that. Android now reports blocking-function-error-response, the kebab-case of the BLOCKING_FUNCTION_ERROR_RESPONSE token in the native error message.

blocking-cloud-function-returned-error is the code the Apple SDK returns. The Android SDK does not return that code, so we should not publish it on Android. Web and Windows already use internal-error and unknown-error for the same failure.

The standard is to surface native errors as they are without tweaking them. I'm closing this on that basis. Thanks again for the effort.

@SelaseKay SelaseKay closed this Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocked: do-not-merge PR blocked externally

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants