0

Why do I keep getting logged out after like 5 minutes of inactivity in google cloud shell when used from gcloud on my local terminal?

ERROR: (gcloud.container.clusters.get-credentials) ResponseError: code=401, message=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.
f

I seem to have stale credentials on the gcloud shell... which just never happens when I'm using the browser version

Ray Foss
  • 3,649
  • 3
  • 30
  • 31
  • Never faced before, how do you authorize it? By `auth login` or `auth application-default login`. – MT-FreeHK Nov 07 '18 at 01:57
  • @MatrixTai I don't. The web cloud shell is always logged in so I never have to `gcloud auth login`. The local terminal version of it however is really finicky... it is alpha though – Ray Foss Nov 08 '18 at 02:16
  • I am bit confused, aren't you use Cloud SDK locally? – MT-FreeHK Nov 08 '18 at 03:59
  • Cliudshell keeps kubectl up to date, logs in automatically and keeps gcloud up to date more than. I care to keep my local one up to date. I get your point though, using cloud she'll from gcloud to not have to update gcloud daily sounds counter productive. But different parts of gcloud require updating more frequently than others and sometimes error out randomly if you don't have the latest version. Gcloud Cloud Shell SSH needs updating maybe once every three months... While gcloud its self releases updates daily... Which is a PITA when you use 5 operating systems and 6 devices daily. – Ray Foss Nov 09 '18 at 04:09

1 Answers1

1

@Ray, according to the official documentation, Cloud Shell is intended for interactive use only, and after some time of inactivity it will kick you out.

Do you have the same issue if you use the Shell from the webpage?

Did you try the steps given here?

Did you authenticate with a service account? if you run gcloud auth list what do you get?

EDIT: This issue was fixed with the new release, @RayFoss commented he was also unable to reproduce it.

  • I was asking about gcloud logging out... cloudshell works just fine over ssh. cloudshell typically authenticates automatically with my google account when I use it over the web... it's only when using the ssh that I was having issues... I gave up on using it over ssh, it was an alpha product anyway – Ray Foss Jan 02 '19 at 15:45
  • Sorry, can you try to explain a little better the issue you had?According to your first post, you said `I keep getting logged out after like 5 minutes of inactivity in google cloud shell`, and for the error you post,(The 401 ) means that something is unauthorised. that's why i was asking if you have already tried authenticating the service or what are the steps you were using to open the Google Shell. – Cristian Sanchez Jan 02 '19 at 16:16
  • 1
    @RayFoss did you just stop using this? just to know if you find a work around or are you still having the issue. – Cristian Sanchez Jan 09 '19 at 09:27
  • seems to have disappeared, tried to reproduce with kubectl and gsutil ls, auth worked for a full hour this time. Will report if I encounter it again. Thanks for looking into this. `Google Cloud SDK 229.0.0, alpha 2018.11.09, core 2019.01.04` – Ray Foss Jan 09 '19 at 17:32