Skip to content

[bug]: flutterfire reconfigure Failed to obtain an access token for making Firebase Management REST API requests. Status code: 400 #380

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 task done
nilsreichardt opened this issue Mar 10, 2025 · 3 comments
Labels
blocked: customer-response Waiting for customer response, e.g. more information was requested. bug Something isn't working Needs Attention OP created or responded to issue and it needs attention.

Comments

@nilsreichardt
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues.

CLI Version

1.1.0

Firebase Tools version

13.22.1

Flutter Doctor Output

[✓] Flutter (Channel stable, 3.29.0, on macOS 15.3.1 24D70 darwin-arm64, locale en-DE) [602ms]
    • Flutter version 3.29.0 on channel stable at /Users/nils/fvm/versions/3.29.0
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 35c388afb5 (4 weeks ago), 2025-02-10 12:48:41 -0800
    • Engine revision f73bfc4522
    • Dart version 3.7.0
    • DevTools version 2.42.2

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0) [2.2s]
    • Android SDK at /Users/nils/Library/Android/sdk
    • Platform android-35, build-tools 35.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
      This is the JDK bundled with the latest Android Studio installation on this machine.
      To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.2) [13.5s]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16C5032a
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web [50ms]
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.3.1) [50ms]
    • Android Studio at /Applications/Android Studio Preview.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7281165)

[✓] Android Studio (version 2022.3) [48ms]
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[✓] IntelliJ IDEA Community Edition (version 2023.1) [48ms]
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] IntelliJ IDEA Ultimate Edition (version 2022.2.3) [30ms]
    • IntelliJ at /Users/nils/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/222.4345.14/IntelliJ
      IDEA.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] VS Code (version 1.96.4) [11ms]
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.102.0

[✓] VS Code (version 1.96.0-insider) [11ms]
    • VS Code at /Applications/Visual Studio Code - Insiders.app/Contents
    • Flutter extension version 3.100.0

[✓] Connected device (4 available) [7.3s]
    • Nils’s iPhone (mobile)          • 00008110-00042D6011D3801E • ios            • iOS 18.3.1 22D72
    • macOS (desktop)                 • macos                     • darwin-arm64   • macOS 15.3.1 24D70 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad     • darwin         • macOS 15.3.1 24D70 darwin-arm64
    • Chrome (web)                    • chrome                    • web-javascript • Google Chrome 134.0.6998.44

[✓] Network resources [507ms]
    • All expected network resources are available.

• No issues found!

Description

When I run flutterfire reconfigure or flutterfire reconfigure --account MY_EMAIL in my project, I get:

flutterfire reconfigure
Failed to write android google-services.json file write for default service file. Please report this issue at:https://github.com/invertase/flutterfire_cli. Exception: Exception: Failed to obtain an access token for making Firebase Management REST API requests. Status code: 400. Response body: {
  "error": "invalid_grant",
  "error_description": "reauth related error (invalid_rapt)",
  "error_uri": "https://support.google.com/a/answer/9368756",
  "error_subtype": "invalid_rapt"
}
Exception: Failed to obtain an access token for making Firebase Management REST API requests. Status code: 400. Response body: {
  "error": "invalid_grant",
  "error_description": "reauth related error (invalid_rapt)",
  "error_uri": "https://support.google.com/a/answer/9368756",
  "error_subtype": "invalid_rapt"
}

Steps to reproduce

Run flutterfire reconfigure

Expected behavior

No errors.

Screenshots

No response

Additional context and comments

No response

@nilsreichardt nilsreichardt added bug Something isn't working triage labels Mar 10, 2025
@nilsreichardt
Copy link
Contributor Author

Using firebase login --reauth fixed the issue. Would be great to have a more developer friendly error message.

@github-actions github-actions bot added the Needs Attention OP created or responded to issue and it needs attention. label Mar 10, 2025
Copy link

github-actions bot commented Apr 7, 2025

Hello 👋, to help manage issues we automatically close stale issues.

This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?

This issue will be closed in 15 days if no further activity occurs.

Thank you for your contributions.

@github-actions github-actions bot added the Stale label Apr 7, 2025
@russellwheatley
Copy link
Member

@nilsreichardt - if you would like to open a PR, here is how I would do it

  1. Create an exception here for the reauth use case: https://github.com/invertase/flutterfire_cli/blob/main/packages/flutterfire_cli/lib/src/common/strings.dart#L130-L131
  2. check response code here: https://github.com/invertase/flutterfire_cli/blob/main/packages/flutterfire_cli/lib/src/firebase.dart#L542
  3. throw this specific exception, write a message about how to solve it.

@russellwheatley russellwheatley added blocked: customer-response Waiting for customer response, e.g. more information was requested. and removed Needs Attention OP created or responded to issue and it needs attention. Stale triage labels Apr 15, 2025
@github-actions github-actions bot added the Needs Attention OP created or responded to issue and it needs attention. label Apr 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked: customer-response Waiting for customer response, e.g. more information was requested. bug Something isn't working Needs Attention OP created or responded to issue and it needs attention.
Projects
None yet
Development

No branches or pull requests

2 participants