'Firebase App Distribution (fastlane plugin): could not generate credentials from the refresh token

The problem is I can not authorise in Firebase (App Distribution could not generate credentials from the refresh token specified). I got an error:

App Distribution could not generate credentials from the refresh token specified.
Refresh token used: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXfE-VQ" (redacted)
Authorization failed.  Server message:
{
  "error": "invalid_grant",
  "error_description": "Bad Request"
}
Response status: 400

+------+------------------------------------+-------------+
|                    fastlane summary                     |
+------+------------------------------------+-------------+
| Step | Action                             | Time (in s) |
+------+------------------------------------+-------------+
| 1    | default_platform                   | 0           |
| 2    | :app:assembleSkRelease             | 5           |
| 3    | Switch to android defineGroup lane | 0           |
| 4    | Switch to android distributeFB     | 0           |
|      | lane                               |             |
| 💥   | firebase_app_distribution          | 0           |
+------+------------------------------------+-------------+

I tried to generate new refresh token via firebase plugin: bundle exec fastlane run firebase_app_distribution_login several times, but there is no effect. I checked that I correctly setup new $FIREBASE_TOKEN in my environment.

Plugin info:

+-------------------------------------+---------+-------------------------------------+
|                                    Used plugins                                     |
+-------------------------------------+---------+-------------------------------------+
| Plugin                              | Version | Action                              |
+-------------------------------------+---------+-------------------------------------+
| fastlane-plugin-firebase_app_distr  | 0.3.3   | firebase_app_distribution,          |
| ibution                             |         | firebase_app_distribution_add_test  |
|                                     |         | ers,                                |
|                                     |         | firebase_app_distribution_get_late  |
|                                     |         | st_release,                         |
|                                     |         | firebase_app_distribution_get_udid  |
|                                     |         | s,                                  |
|                                     |         | firebase_app_distribution_login,    |
|                                     |         | firebase_app_distribution_remove_t  |
|                                     |         | esters                              |
+-------------------------------------+---------+-------------------------------------+

How can I fix it?



Solution 1:[1]

Check that the value you're setting to $FIREBASE_TOKEN is the one that's printed in the terminal after you enter the code from the website, not this last one.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Alejandro