128
votes

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

2

2 Answers

357
votes

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

34
votes

Use firebase login --reauth, that happened to me because an old FIREBASE_TOKEN was present while trying to exec firebase init