简体   繁体   English

Flutterfire ios 配置问题

[英]Flutterfire ios configuration issues

For some reason, I can't use the Flutterfire CLI to configure an ios app on firebase. I've done this before but this time I'm gettings this error出于某种原因,我无法使用 Flutterfire CLI 在 firebase 上配置 ios 应用程序。我以前做过这个,但这次我遇到了这个错误

FirebaseCommandException: An error occured on the Firebase CLI when attempting to run a command.
COMMAND: firebase apps:create ios good_dreams (ios) --bundle-id=com.infatechnologies.good_dreams --json --project=good-dreams-app 
ERROR: Failed to create iOS app for project good-dreams-app. See firebase-debug.log for more info.

I've tried going through the debug.log file to see what's wrong and I saw a post request with and error code of 401 as a response.我已经尝试通过 debug.log 文件查看出了什么问题,我看到了一个带有 401 错误代码的发布请求作为响应。

{
"error": {
"code": 401,
"message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
"status": "UNAUTHENTICATED",
"details": [
{
"@type": "type.googleapis.com/google.rpc.ErrorInfo",
"reason": "CREDENTIALS_MISSING",
"domain": "googleapis.com",
"metadata": {
"method": "google.firebase.service.v1beta1.IosAppService.ListIosApps",
"service": "firebase.googleapis.com"
}
}
]
}
}

What are these missing credentials?这些缺失的凭据是什么? How do I get them?我如何得到它们? Here is the whole firebase-debug.log file:这是整个 firebase-debug.log 文件:

[debug] [2022-02-15T15:41:11.658Z] ----------------------------------------------------------------------
[debug] [2022-02-15T15:41:11.660Z] Command:       /usr/local/bin/firebase /Users/user/.cache/firebase/tools/lib/node_modules/firebase-tools/lib/bin/firebase apps:create ios good_dreams (ios) --bundle-id=com.infatechnologies.good_dreams --json --project=good-dreams-app
[debug] [2022-02-15T15:41:11.660Z] CLI Version:   10.0.1
[debug] [2022-02-15T15:41:11.660Z] Platform:      darwin
[debug] [2022-02-15T15:41:11.660Z] Node Version:  v12.18.1
[debug] [2022-02-15T15:41:11.661Z] Time:          Tue Feb 15 2022 15:41:11 GMT+0000 (Greenwich Mean Time)
[debug] [2022-02-15T15:41:11.661Z] ----------------------------------------------------------------------
[debug] 
[debug] [2022-02-15T15:41:11.708Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[debug] [2022-02-15T15:41:11.708Z] > authorizing via signed-in user (aduhenry9@gmail.com)
[info] Create your IOS app in project good-dreams-app:
[debug] [2022-02-15T15:41:11.712Z] >>> HTTP REQUEST POST https://firebase.googleapis.com/v1beta1/projects/good-dreams-app/iosApps  
 {"displayName":"good_dreams (ios)","bundleId":"com.infatechnologies.good_dreams"}
[debug] [2022-02-15T15:41:12.192Z] <<< HTTP RESPONSE 400 {"vary":"X-Origin, Referer, Origin,Accept-Encoding","content-type":"application/json; charset=UTF-8","date":"Tue, 15 Feb 2022 15:41:12 GMT","server":"ESF","cache-control":"private","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"","accept-ranges":"none","transfer-encoding":"chunked"}
[debug] [2022-02-15T15:41:12.193Z] <<< HTTP RESPONSE BODY {"error":{"code":400,"message":"Request contains an invalid argument.","status":"INVALID_ARGUMENT"}}
[debug] [2022-02-15T15:41:12.194Z] HTTP Error: 400, Request contains an invalid argument.
[debug] [2022-02-15T15:41:12.689Z] FirebaseError: HTTP Error: 400, Request contains an invalid argument.
    at module.exports (/Users/user/.cache/firebase/tools/lib/node_modules/firebase-tools/lib/responseToError.js:38:12)
    at Request._callback (/Users/user/.cache/firebase/tools/lib/node_modules/firebase-tools/lib/api.js:41:35)
    at Request.self.callback (/Users/user/.cache/firebase/tools/lib/node_modules/request/request.js:185:22)
    at Request.emit (events.js:315:20)
    at Request.EventEmitter.emit (domain.js:482:12)
    at Request.<anonymous> (/Users/user/.cache/firebase/tools/lib/node_modules/request/request.js:1154:10)
    at Request.emit (events.js:315:20)
    at Request.EventEmitter.emit (domain.js:482:12)
    at IncomingMessage.<anonymous> (/Users/user/.cache/firebase/tools/lib/node_modules/request/request.js:1076:12)
    at Object.onceWrapper (events.js:421:28)
    at IncomingMessage.emit (events.js:327:22)
    at IncomingMessage.EventEmitter.emit (domain.js:482:12)
    at endReadableNT (_stream_readable.js:1221:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)
[error] 
[error] Error: Failed to create iOS app for project good-dreams-app. See firebase-debug.log for more info.

I thought the bundle id (ios) and package name (android) should be the same, they should not.我认为捆绑ID(ios)和包名称(android)应该相同,它们不应该。 The organisation might be the same but what comes last should not.该组织可能是相同的,但最后的不应该。 That was the issue although it's not stated in any guide/tutorials I could find, not even in the error messages这就是问题所在,尽管我能找到的任何指南/教程中都没有说明,甚至在错误消息中也没有说明

It's an authentication issue.这是一个身份验证问题。 Just logout firebase CLI and log in again.只需注销 firebase CLI 并再次登录。

To logout :注销:

firebase logout

To login again :再次登录:

firebase login

You can always try creating the IOS app manually via the Firebase Console (that's how I always do it).您可以随时尝试通过 Firebase 控制台手动创建 IOS 应用程序(我一直都是这样做的)。

在此处输入图像描述

在此处输入图像描述

to configure iOS:配置 iOS:

flutterfire configure -icom.ios.bubdle

so add -i then your (ios) bundle id所以添加 -i 然后你的(ios)捆绑ID

from CLI CommandsCLI 命令

Aha!啊哈! I've found the answer.我找到了答案。 So for some reason, apple doesn't allow underscore("_") in bundleId names, change your bundleId to not use underscore and you'd be good to go.因此,出于某种原因,Apple 不允许在 bundleId 名称中使用下划线(“_”),请将您的 bundleId 更改为不使用下划线,这样就可以了。

Let me know if this helps.让我知道这是否有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM