firebase / firebase-tools

The Firebase Command Line Tools
MIT License
4k stars 922 forks source link

Error: Authentication required #160

Closed zosocanuck closed 6 years ago

zosocanuck commented 8 years ago

Hi,

I recently upgraded to the new Firebase console however when running firebase deploy I get

Error: Authentication required.

So I logout and then login again however still get the same results.

Any ideas?

mbleigh commented 8 years ago

Can you please run firebase deploy --debug and paste the output here? Also, what do you get when you run firebase list? Do you see the project there?

One final thing to check is to make sure that you are deploying to the project id not the subdomain of your app.

zosocanuck commented 8 years ago

Ok, I ended up upgrading nodejs on my windows laptop and firebase list did show my projects. But when I run firebase deploy I get:

Error: Unable to authorize access to project milohas

Note: This version of the Firebase CLI is only compatible with projects upgraded to the new Firebase Console. To access firebase.com apps, you will need to use a previous version: npm install -g firebase-tools@^2.1

I do have permission to access this project as I am successfully able to run firebase deploy on a Fedora 23 VM.

mbleigh commented 8 years ago

When you run firebase list, do you see a different project id and instance name for this project? If so, make sure your .firebaserc file has the project id not the instance/subdomain name.

hickford commented 8 years ago

I have the same problem:

$ firebase deploy
Error: Authentication required.
$ firebase login
Already logged in as ****@gmail.com

This happened after 'upgrading' my app from the 'legacy console' at https://www.firebase.com/account/ to https://console.firebase.google.com/

tavosansal commented 8 years ago

Having the same issue here. When I do firebase list I do not see my project. I recently upgraded to the new Firebase and started getting these issues. Some help on this would be appreciated since I can no longer deploy my project. Is there a way to manually deploy stuff??

tavosansal commented 7 years ago

Any update on this? I literally cannot deploy any updated with a fix for this.

hickford commented 7 years ago

@tavosansal try downgrading npm install -g firebase-tools@2. I worked it out eventually; firebase-tools@3 is incompatible with "legacy console" apps at https://www.firebase.com/account/

Frustrating isn't it?

  1. Client is not backwards compatible
  2. Readme neglects to warn about backwards incompatibility
  3. Backwards incompatible client gives unhelpful and misleading error message "Error: Authentication required" rather than explain the problem and how to workaround it
Lionardo commented 7 years ago

I have the same issue for a while now. I tried a couple of things like downgrading firebase-tools@2, I have the project id on .firebaserc and no subdomain but nothing works. I get no project listed on firebase list but i clearly have a project on the dashboard. I also tried to deploy with a FIREBASE_TOKEN but without success. Here is my firebase --debug

Error Context: {
  "requestOptions": {
    "method": "GET",
    "json": true,
    "url": "https://admin.firebase.com/firebase/talentmap/token?token=-KFQF7KUYFZ7AvBQG_FN%7Ca3600ce1d3feedf3bb38df18a5e3199f"
  },
  "body": {
    "error": {
      "code": "AUTHENTICATION_REQUIRED",
      "message": "Authentication required."
    }
  },
  "response": {
    "statusCode": 401,
    "body": {
      "error": {
        "code": "AUTHENTICATION_REQUIRED",
        "message": "Authentication required."
      }
    },
    "headers": {
      "server": "nginx",
      "date": "Sun, 27 Nov 2016 14:30:16 GMT",
      "content-type": "application/json; charset=utf-8",
      "content-length": "81",
      "connection": "close",
      "access-control-allow-origin": "*",
      "access-control-allow-methods": "GET, PUT, POST, DELETE, OPTIONS",
      "x-content-type-options": "nosniff"
    },
    "request": {
      "uri": {
        "protocol": "https:",
        "slashes": true,
        "auth": null,
        "host": "admin.firebase.com",
        "port": 443,
        "hostname": "admin.firebase.com",
        "hash": null,
        "search": "?token=-KFQF7KUYFZ7AvBQG_FN%7Ca3600ce1d3feedf3bb38df18a5e3199f",
        "query": "token=-KFQF7KUYFZ7AvBQG_FN%7Ca3600ce1d3feedf3bb38df18a5e3199f",
        "pathname": "/firebase/talentmap/token",
        "path": "/firebase/talentmap/token?token=-KFQF7KUYFZ7AvBQG_FN%7Ca3600ce1d3feedf3bb38df18a5e3199f",
        "href": "https://admin.firebase.com/firebase/talentmap/token?token=-KFQF7KUYFZ7AvBQG_FN%7Ca3600ce1d3feedf3bb38df18a5e3199f"
      },
      "method": "GET",
      "headers": {
        "accept": "application/json"
      }
    }
  }
}
arangates commented 7 years ago

i faced same issue ... i did firebase logoutand then tried again.Everything worked out !

ckunta commented 7 years ago

I'm facing the same issue from last night. No change on the firebase-cli and I was able to deploy successfully earlier (about 3 hours prior). I tried login/logout but still not working. I noticed that running curl I received 'AUTHENTICATION_REQUIRED' return. And running firebase deploy I received 'Auth token is expired', but I don't know how to renew it. I can still get into the Firebase console with the same account without any problem. Here are the capture.

curl https://admin.firebase.com/v1/database/fir-auth-a8de1/tokens curl : {"error":{"code":"AUTHENTICATION_REQUIRED","message":"Authentication required."}} At line:1 char:1

firebase deploy --debug

Command: C:\Program Files\nodejs\node.exe E:\AppData\Roaming\npm\node_modules\firebase-tools\bin\firebase deploy --debug CLI Version: 3.2.1 Platform: win32 Node Version: v4.4.4 Time: Wed May 10 2017 07:05:35 GMT-0600 (Mountain Daylight Time)

.....

command requires scopes: >>> HTTP REQUEST GET https://admin.firebase.com/v1/database/fir-auth-a8de1/tokens <<< HTTP RESPONSE 200 server=nginx, date=Wed, 10 May 2017 13:05:33 GMT, content-type=application/json; charset=utf-8, content-length=427, connection=close, x-content-type-options=nosniff, strict-transport-security=max-age=31536000; includeSubdomains, cache-control=no-cac he, no-store

=== Deploying to 'fir-auth-a8de1'...

i deploying database, hosting

<<< HTTP RESPONSE 401 server=nginx, date=Wed, 10 May 2017 14:55:53 GMT, content-type=application/json; charset=utf-8, co ty=max-age=31556926; includeSubDomains; preload, x-content-type-options=nosniff <<< HTTP RESPONSE BODY undefined TypeError: Cannot read property 'error' of undefined at module.exports (E:\AppData\Roaming\npm\node_modules\firebase-tools\lib\responseToError.js:10:12) at Request._callback (E:\AppData\Roaming\npm\node_modules\firebase-tools\lib\api.js:37:25) at Request.self.callback (E:\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\request\reques at emitTwo (events.js:87:13) at Request.emit (events.js:172:7) at Request. (E:\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\request\request. at emitOne (events.js:77:13) at Request.emit (events.js:169:7) at IncomingMessage. (E:\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\request\ at IncomingMessage.g (events.js:260:16)

Error: An unexpected error has occurred.

saifalfalah commented 6 years ago

I removed firebase.json and .firebaserc and ran firebase init again. It worked.

ckunta commented 6 years ago

Thank you. I'll keep that in mind if it happens again. I don't remember how I resolved it then.