Skip to content

[firebase_auth]: User.getIdTokenResult throws exception with wrong error code "no-such-provider" #12809

Description

@kinex

Is there an existing issue for this?

  • I have searched the existing issues.

Which plugins are affected?

Auth

Which platforms are affected?

Android

Description

I see from Crashlytics this crash happening sometimes:

Fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError: [firebase_auth/no-such-provider] User was not linked to an account with the given provider.. Error thrown main.
       at FirebaseAuthUserHostApi.getIdToken(messages.pigeon.dart:1605)
       at MethodChannelUser.getIdTokenResult(method_channel_user.dart:58)

It happens sometimes when I call User.getIdTokenResult. The error code no-such-provider cannot be correct because only User.unlink should give that error code. I have no idea what is the actual error happening here, because I cannot reproduce the issue myself.

I think the problem is on this line:
https://github.com/firebase/flutterfire/blob/master/packages/firebase_auth/firebase_auth/android/src/main/java/io/flutter/plugins/firebase/auth/FlutterFirebaseAuthPluginException.java#L69
It makes a very unsafe assumption that any ExecutionException is always no-such-provider.

Reproducing the issue

I cannot reproduce the issue, but it happens when User.getIdTokenResult is called.

Firebase Core version

2.31.0

Flutter Version

3.22.0

Relevant Log Output

No response

Flutter dependencies

No response

Additional context and comments

No response

Metadata

Metadata

Assignees

Labels

Needs AttentionThis issue needs maintainer attention.platform: androidIssues / PRs which are specifically for Android.plugin: authresolution: fixedA fix has been merged or is pending merge from a PR.type: bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions