Home > OS >  Flutterfire ios configuration issues
Flutterfire ios configuration issues

Time:02-16

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

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.

{
"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:

[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 ([email protected])
[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.

CodePudding user response:

It's an authentication issue. Just logout firebase CLI and log in again.

To logout :

firebase logout

To login again :

firebase login

CodePudding user response:

I thought the bundle id (ios) and package name (android) should be the same, they should not. 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

CodePudding user response:

You can always try creating the IOS app manually via the Firebase Console (that's how I always do it).

enter image description here

enter image description here

  • Related