问题是我无法在 Firebase 中授权(App Distribution 无法从指定的刷新令牌生成凭据)。我收到一个错误:
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 |
+------+------------------------------------+-------------+
我多次尝试通过firebase插件生成新的刷新令牌:
bundle exec fastlane run firebase_app_distribution_login
,但没有效果。我检查了我是否在我的环境中正确设置了新的 $FIREBASE_TOKEN
。
插件信息:
+-------------------------------------+---------+-------------------------------------+
| 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 |
+-------------------------------------+---------+-------------------------------------+
我该如何修复它?
检查您设置的 $FIREBASE_TOKEN 值是否是您输入网站代码后在终端中打印的值,而不是最后一个值。
我遇到了同样的问题并解决了以下步骤。
此问题源于您的 FIREBASE_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"
按照上述步骤,我就可以构建和部署了。