Repository navigation
Add a colab logout command to sign out and switch accounts
#208
pengqianhan
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Problem
colabhas no command to sign out or switch Google accounts. Neithercolab --help, the README, nor the docs describe how to do it. The account in use is also hard to discover, becausecolab whoamiis hidden from--help.Today, the only way to sign out is to know where the token is stored and remove it by hand. That location depends on the version:
~/.config/colab-cli/token.jsonmain: the OS keyring (servicegoogle-colab-cli, usernameoauth_token), withtoken.jsonmigrated and then deletedRemoving the token locally also doesn't revoke it. The refresh token stays valid until the user finds the right entry on their Google Account permissions page. Logs written by versions affected by #177 can also still contain tokens, so deleting the token alone may leave credentials on disk.
Proposal
Add a
colab logoutcommand for theoauth2provider that:--revoke, see the question below).token.json, so the legacy migration path can't restore the old login.The next command would then start the normal sign-in flow, so switching accounts becomes:
With
--auth=adc, the CLI doesn't own the credentials, socolab logoutshould leave them alone and point togcloud auth application-default revoke.Also worth considering
colab whoami, or add a similar supported command, so users can check which account is active before and after switching.colab.logduring logout, for logs left over from versions affected by [Bug]: Tokens written to colab.log in plain text; token.json/colab.log created with default (umask) permissions #177.Open question
The bundled OAuth client is the cloud SDK client (
764086051850-...). Could revoking the token also affect the user'sgcloudlogin for that account? If so, a local-only logout by default with an explicit--revokeflag may be the safer design.Environment
Observed on
google-colab-cli0.7.4 on macOS. Keyring details are from the docs and source onmain.All reactions