HTTP Error: 401 while setting up firebase cloud functions for android project

M.Ali picture M.Ali · Oct 19, 2018 · Viewed 17.4k times · Source

I`m trying to set up firebase functions, but I get an error after running firebase init.

Error: HTTP Error: 401, Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.

enter image description here

Answer

M.Ali picture M.Ali · Oct 19, 2018

I solved the problem! you need to logout firebase logout then log-in firebase login again or just refresh the token with firebase login --reauth

it seems that the expiry time of Firebase auth token is limited to max 1Hr