feat(cursor): add sqlite-first auth with keychain fallback#210
Merged
Conversation
Read Cursor tokens from Desktop SQLite first, then fall back to CLI keychain tokens. Persist refreshed access tokens to the active source and add regression tests plus provider docs for the new auth source order. Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds Cursor CLI authentication support to enable usage tracking for users who use agent login instead of or alongside Cursor Desktop. The implementation follows a SQLite-first, keychain-fallback pattern similar to the Claude plugin, ensuring Desktop users are unaffected while CLI users gain full support.
Changes:
- SQLite tokens (Desktop) take precedence; keychain tokens (CLI) serve as fallback
- Token refresh now persists updated access tokens back to their original source
- Enhanced error messages guide users to both Desktop and CLI login options
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| plugins/cursor/plugin.js | Implements keychain read/write functions, loadAuthState with source tracking, and updates refreshToken to persist to correct source |
| plugins/cursor/plugin.test.js | Adds 3 comprehensive tests covering keychain fallback, refresh persistence, and SQLite precedence |
| docs/providers/cursor.md | Documents dual auth sources, token precedence order, and CLI setup instructions |
| README.md | Updates Cursor feature list to mention CLI auth support |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
validatedev
approved these changes
Feb 23, 2026
Collaborator
validatedev
left a comment
There was a problem hiding this comment.
Do not see any potential issue, approved!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add Cursor CLI-compatible auth fallback while keeping Cursor Desktop as the primary token source. The plugin now reads Cursor tokens from Desktop SQLite first and falls back to keychain services used by CLI login.
Related Issue
Fixes #208
Type of Change
Testing
bun run buildand it succeededbun run testand all tests passbun tauri devAdditional verification performed:
bun run test plugins/cursor/plugin.test.js(pass)bun run test:coverage(fails due existing threshold:plugins/gemini/plugin.jsbranch coverage 70.61% < 80%)Screenshots
N/A (no UI changes)
Checklist
mainbranchMade with Cursor
Note
Medium Risk
Changes authentication token sourcing and persistence for the Cursor plugin, which can affect login/refresh behavior if keychain/SQLite interactions differ across environments.
Overview
Updates the Cursor provider to load auth tokens from Cursor Desktop’s SQLite state DB first, with a fallback to Cursor CLI keychain entries when SQLite tokens are missing.
Token refresh now persists the new access token back to the same source it was loaded from (SQLite or keychain), and user-facing error messages now suggest
agent loginas an alternative sign-in path. Documentation and tests were expanded to cover keychain loading, refresh persistence behavior, and SQLite-vs-keychain precedence.Written by Cursor Bugbot for commit 3e8c07a. This will update automatically on new commits. Configure here.
Summary by cubic
Add SQLite-first auth with Cursor CLI keychain fallback for the Cursor provider. Desktop and
agent loginboth work, and refreshed tokens persist to their source (fixes #208).agent login."Written for commit 62db424. Summary will update on new commits.