使用服务帐户凭据模式的Firebase发行版android应用拒绝了权限 [英] Permission denied with Firebase distribution android app using service account credentials mode
问题描述
我正在尝试从Fabric迁移到Firebase,因为Fabric将在2020年3月31日之后才可用.
I'm trying to migrate from Fabric to Firebase since Fabric will not be available beyond March 31, 2020.
我已经完成了第一步:将插件和依赖项添加到gradle,添加分析json文件,甚至崩溃报告,而且一切似乎都是正确的,因为我可以在Firebase控制台中看到数据(分析和崩溃).
I already have done the first steps: adding plugins and dependencies to gradle, adding analytics json file, even crash reporting, and all seems correct because I can see data in the Firebase console (analytics and crashes).
但是我不太幸运将应用程序分发系统从Beta + Fastlane迁移到Firebase.我正在尝试选项"使用Gradle将Android应用分发给测试人员".我已经添加了插件和依赖项,并且添加得很好,因为我可以运行gradle任务./gradlew appDistributionUploadMyVariant
.
But I'm not so lucky migrating the app distribution system from Beta+Fastlane to Firebase. I'm trying the option "Distribute Android apps to testers using Gradle". I've already added the plugin and the dependency and it is well added because I can run the gradle task ./gradlew appDistributionUploadMyVariant
.
我正在从Google Cloud Platform控制台获取名为正确的项目的用户firebase-adminsdk
(我认为此名称由Firebase系统指定)的serviceCredentialsFile
.用户的电子邮件类似于此firebase-adminsdk-xxx@my_project.iam.gserviceaccount.com
,与我在 Firebase控制台->设置->服务帐户-> Firebase Admin SDK 中看到的相同.
I'm getting the serviceCredentialsFile
from the Google Cloud Platform console for the user called firebase-adminsdk
(I think this name is given by the Firebase system) for the correct project. The email of the user is something like this firebase-adminsdk-xxx@my_project.iam.gserviceaccount.com
, and it is the same as I can see in Firebase console -> Settings -> Service accounts -> Firebase Admin SDK.
我已经下载了带有凭据的json文件,并且gradle可以找到它,因为如果故意为文件放置错误的路径URL,它将记录Service credentials file does not exist
.根据我上面提到的几行内容,该文件的内容具有client_email
和project_id
的正确值.
I've downloaded the json file with the credentials and gradle can find it because if a put a wrong path-url intentionally for the file it logs a Service credentials file does not exist
. The content of this file has the correct values for the client_email
and project_id
according to what I mentioned some lines above.
但是我收到403错误.如果执行任务./gradlew appDistributionUploadMyVariant --info
,我会粘贴一些信息(我已经隐藏了一些私人信息):
But I'm getting a 403 error. I paste some of the info I get if I execute the task ./gradlew appDistributionUploadMyVariant --info
(I've hide some private information):
Task ':app:appDistributionUploadMyVariant' is not up-to-date because:
Task has not declared any outputs despite executing actions.
Found APK at /MyFolder/app/build/outputs/apk/qa/qaType/app-qa-qaType.apk.
Uploading APK to Firebase App Distribution...
Getting appId from output of google services plugin
-------------- REQUEST --------------
POST https://oauth2.googleapis.com/token
Accept-Encoding: gzip
User-Agent: Google-HTTP-Java-Client/1.28.0 (gzip)
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Content-Length: 808
curl -v --compressed -X POST -H 'Accept-Encoding: gzip' -H 'User-Agent: Google-HTTP-Java-Client/1.28.0 (gzip)' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -d '@-' -- 'https://oauth2.googleapis.com/token' << $$$
Total: 808 bytes
grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer&assertion=eyJhbGciOiJSUzI1N(...)
-------------- RESPONSE --------------
HTTP/1.1 200 OK
Transfer-Encoding: chunked
X-Frame-Options: SAMEORIGIN
Alt-Svc: quic=":443"; ma=2592000; v="46,43",h3-Q050=":443"; ma=2592000,h3-Q049=":443"; ma=2592000,h3-Q048=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000
Cache-Control: private
Server: scaffolding on HTTPServer2
X-Content-Type-Options: nosniff
Content-Encoding: gzip
Vary: Referer
Vary: X-Origin
Vary: Origin
X-XSS-Protection: 0
Date: Fri, 22 Nov 2019 14:47:29 GMT
Content-Type: application/json; charset=utf-8
Total: 207 bytes
{
"access_token": "access_token_value",
"expires_in": 3600,
"token_type": "Bearer"
}
-------------- REQUEST --------------
GET https://firebaseappdistribution.googleapis.com/v1alpha/apps/appId
Accept-Encoding: gzip
Authorization: <Not Logged>
User-Agent: Firebase App Distro Client/1.2.0
x-app-distro-api-client-id: com.google.firebase
x-app-distro-api-client-type: gradle
x-app-distro-api-client-version: 1.2.0
curl -v --compressed -H 'Accept-Encoding: gzip' -H 'Authorization: <Not Logged>' -H 'User-Agent: Firebase App Distro Client/1.2.0' -H 'x-app-distro-api-client-id: com.google.firebase' -H 'x-app-distro-api-client-type: gradle' -H 'x-app-distro-api-client-version: 1.2.0' -- 'https://firebaseappdistribution.googleapis.com/v1alpha/apps/appId'
-------------- RESPONSE --------------
HTTP/1.1 403 Forbidden
Transfer-Encoding: chunked
X-Frame-Options: SAMEORIGIN
Alt-Svc: quic=":443"; ma=2592000; v="46,43",h3-Q050=":443"; ma=2592000,h3-Q049=":443"; ma=2592000,h3-Q048=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000
Cache-Control: private
Server: ESF
X-Content-Type-Options: nosniff
Content-Encoding: gzip
Vary: Referer
Vary: X-Origin
Vary: Origin
X-XSS-Protection: 0
Date: Fri, 22 Nov 2019 14:47:30 GMT
Content-Type: application/json; charset=UTF-8
Total: 126 bytes
{
"error": {
"code": 403,
"message": "The caller does not have permission",
"status": "PERMISSION_DENIED"
}
}
:app:appDistributionUploadMyVariant (Thread[Daemon worker Thread 8,5,main]) completed. Took 1.552 secs.
AAPT2 aapt2-3.4.1-5326820-osx Daemon #0: shutdown
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:appDistributionUploadMyVariant'.
> App Distribution failed to fetch app information: [403] The caller does not have permission
我还试图从gradle文件中传递appId
值,结果相同.
I've also tried to pass the appId
value from the gradle file with the same result.
有什么主意吗?
推荐答案
错误"[403]呼叫者没有权限."是由权限问题引起的.
Error "[403] The caller does not have permission." is caused by a permission issue.
您可以尝试遵循此如何创建服务帐户以及在哪里下载json,看看它是否有效?
Can you try to follow this on how to create service account and where to download the json, to see if it works?
也欢迎您联系 firebase支持了解更多信息. :)
You are also welcome to reach out to firebase support with more info. :)
这篇关于使用服务帐户凭据模式的Firebase发行版android应用拒绝了权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!