简体   繁体   中英

Firebase CLI how to change project scope?firebase init(error:403, The caller does not have permission) uses project url of another account

My error when using firebase init --debug

[2019-01-28T05:32:18.956Z] Error Context: {
  "body": {
"error": {
  "code": 403,
  "message": "The caller does not have permission",
  "status": "PERMISSION_DENIED"
}
},
"response": {
"statusCode": 403,
"body": {
  "error": {
    "code": 403,
    "message": "The caller does not have permission",
    "status": "PERMISSION_DENIED"
  }
},
"headers": {
  "vary": "X-Origin, Referer, Origin,Accept-Encoding",
  "content-type": "application/json; charset=UTF-8",
  "date": "Mon, 28 Jan 2019 05:32:18 GMT",
  "server": "ESF",
  "cache-control": "private",
  "x-xss-protection": "1; mode=block",
  "x-frame-options": "SAMEORIGIN",
  "x-content-type-options": "nosniff",
  "alt-svc": "quic=\":443\"; ma=2592000; v=\"44,43,39\"",
  "accept-ranges": "none",
  "transfer-encoding": "chunked"
},
"request": {
  "uri": {
    "protocol": "https:",
    "slashes": true,
    "auth": null,
    "host": "firebase.googleapis.com",
    "port": 443,
    "hostname": "firebase.googleapis.com",
    "hash": null,
    "search": null,
    "query": null,
    "pathname": "/v1beta1/projects/young-picasso",
    "path": "/v1beta1/projects/young-picasso",
    "href": "https://firebase.googleapis.com/v1beta1/projects/young-picasso"
  },
  "method": "GET"
  }
}
}

How can I change the path of project to the one that i am currently using? I am currently working on project in different account but the path shown is the project of previous account. Currently it shows young picasso but my project path is different in another account. I am new on firebase cli and I dont know how to fix this, how can I fix this?

Also, firebase list command shows my project that i am currently working as current and permission type is owner. I also have already used command firebase -login --reauth to change from previous account to another account.

I solved this by delete this file .firebaserc .

Steps:

  1. Find file .firebaserc at Your Application Folder.
  2. Delete it.
  3. Try again at CMD. firebase init

Good luck

对我来说,我使用了错误的 Google 帐户,为了解决我使用了命令firebase logout ,并在firebase login

删除两个文件,.firebaserc 和 firebase.json 然后重做它会修复它的过程。

Now you can do this only online because you need to accept terms and conditions to get permission.

link to page: https://console.firebase.google.com/

Re-installing the firebase-tools on npm worked! However, if anybody know how to fix the project scope without re-installing npm firebase-tools then please let me know.

Deleting the [hidden] .firebaserc file, (that's generated via the Firebase CLI tool), should solve the issue for most people, although as previously mentioned, you may need to delete the .firebase.json file too.

However , Firebase will still look for this file, so you'll need to have one. The file is very minimal, lives in the root of your project, and looks like this, (in it's entirety):

{
  "projects": {
    "default": "my-project-id"
  }
}

I experienced this error, when I had previously run $ firebase init on two very similar test apps, and later decided to merge aspects of one app into the other, but hadn't kept the correct .firebaserc file, which meant I had the incorrect 'Project ID' in the aforementioned file.

Why does this matter? The .firebaserc contains the primary Firebase Project ID: xxxxxxxxxx , which can be found via your Firebase console under Project Overview > Settings . If the ID in the file doesn't reflect your Firebase 'Project ID', Firebase will reject any of your requests.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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