[M.Ali (accepted answer)] 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

Context: Stack Overflow #52891500 (accepted answer, 648 votes, 5 answers): 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.