HTTP Error: 401 while setting up firebase cloud functions for android project
FirebaseGoogle Cloud-FunctionsFirebase CliFirebase Problem Overview
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.
Firebase Solutions
Solution 1 - Firebase
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
Solution 2 - Firebase
Use firebase login --reauth
, that happened to me because an old FIREBASE_TOKEN
was present while trying to exec firebase init
Solution 3 - Firebase
I solved it by manually deleting the FIREBASE_TOKEN
from my environment variables, THEN issued a firebase login --reauth
.
Note: I tried to re-authenticate without deleting the Firebase token first, but didn't work for me.
Solution 4 - Firebase
Had the same issue but with firebase hosting. For some reason only using sudo firebase