1

I am using oauth2 for my python CLI script.

I am using the code from here : https://github.com/google/google-api-python-client/blob/master/samples/calendar_api/calendar_sample.py

I am running the script with ("--noauth_local_webserver" ) option .

The first time i ran the script , it asked me to sign in to google page and gave me a verification code which i input in my script and it authorized successfully. But from next time onwards its taking that same account which I logged in the first time by default.

I have tried closing the terminal , but still it doesn't show up the oauth2 UI for signing in again .

So I am not able to figure out how to log out of this thing when i am terminating my script. Based on the shown code , how to logout or at least re signin when i run my script every time ?

Natesh bhat
  • 12,274
  • 10
  • 84
  • 125
  • As the code you're using suggests, you're basically looking to trigger [the exception](https://github.com/google/google-api-python-client/blob/d9f47bd91b1a17ce971381f00360b9252b1aab8e/samples/calendar_api/calendar_sample.py#L44), right? You need to re signing when your credentials have been revoked or expired, the key is here. *I have tried closing the terminal*... closing the terminal does not log you out, there are [credentialed accounts](https://cloud.google.com/sdk/gcloud/reference/auth/list) even so – Tudormi Feb 27 '18 at 08:53

0 Answers0