Pasha Oleynik
Pasha Oleynik

Reputation: 515

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?

Upvotes: 1

Views: 4751

Answers (2)

Kaito Kitaya
Kaito Kitaya

Reputation: 61

I came across the same problem and solved the following steps.

Cause

This problem comes from your FIREBASE_CLI_TOKEN is expired.

How to solve.

  1. Execute the following command to retrieve your refreshed CLI token
$ firebase login:ci
Waiting for authentication...

āœ”  Success! Use this token to login on a CI server:

{TOKEN can be shown here}

Example: firebase deploy --token "$FIREBASE_TOKEN"

  1. Set the token Set your token you get previous step to the environment variable in your CI server. If you have not create it yet, create it to your environment variable.

Following the above steps, and I could build and deploy.

Upvotes: 0

Alejandro
Alejandro

Reputation: 110

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.

Upvotes: 3

Related Questions