Skip to content

feat(auth): store OAuth tokens in keyring - #182

Open
hjjackyang wants to merge 12 commits into
mainfrom
keyring
Open

hjjackyang wants to merge 12 commits into
mainfrom
keyring

Conversation

@hjjackyang

@hjjackyang hjjackyang commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Why? The existing way of storing the OAuth tokens in user's local file system is insecure.

The new change implements the following:

  1. Stores OAuth tokens in user's system keyring.
  2. If system keyring is locked, the keyring library will prompt users to unlock. Times out in 30s if users don't confirm unlocking. Kicks off a new OAuth flow.
  3. If a legacy token file exists on user's local filesystem, CLI will attempt to migrate that into keyring and clean it up.

Tested locally with:

# Complete the OAuth flow to list sessions
uv run colab --auth=oauth2 sessions

# Examine the token json stored in keyring
uv run keyring get google-colab-cli oauth_token

Internal tracking bug: b/575978563

@hjjackyang
hjjackyang marked this pull request as ready for review October 22, 2026 00:03
Comment thread src/colab_cli/auth.py
Comment thread src/colab_cli/auth.py Outdated
Comment thread src/colab_cli/auth.py
@hjjackyang
hjjackyang requested a review from sethtroisi October 23, 2026 03:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants