Skip to content

feat: authenticate with OAuth DCR and PKCE - #20

Open
ishaanxgupta wants to merge 3 commits into
mainfrom
ishaan/cursor-plugin-oauth-dcr
Open

ishaanxgupta wants to merge 3 commits into
mainfrom
ishaan/cursor-plugin-oauth-dcr

Conversation

@ishaanxgupta

@ishaanxgupta ishaanxgupta commented Oct 23, 2026 •

Copy link
Copy Markdown

Browser sign-in currently opens console auth/connect and saves a long-lived sm_ API key. Login now uses the Supermemory OAuth 2.1 authorization server, the same flow as the Claude Code and Codex plugins.

  • Discover the authorization server, register a public client named "Supermemory for Cursor" (callback 127.0.0.1:19879), and reuse the registration across logins.
  • Authorize with S256 PKCE, random state and issuer validation. Store access and refresh tokens atomically with owner-only permissions, bound to the API URL, issuer and MCP resource.
  • Hooks and the MCP proxy resolve the bearer per request, so the proxy recovers when login finishes after it started. Refresh serializes across processes and always saves the rotated tokens, even when a hook stops waiting.
  • login migrates a saved API key; logout revokes the refresh token. Status shows auth type and client ID only.
  • SUPERMEMORY_API_KEY, a config apiKey or a saved {apiKey} file keep precedence and keep working unchanged.

Verified live against the mono PR preview: consent shows "Supermemory for Cursor" as a Plugin, Deny shows an "Authorization denied" page and saves nothing, a second login reuses the registered client, the session-start hook refreshes an expired token, and logout revokes the refresh token.

Requires https://github.com/supermemoryai/mono/pull/3087 for the consent screen to name the plugin and attribute requests to its OAuth client. Same design as supermemoryai/claude-supermemory#121 and supermemoryai/codex-supermemory#71.

Supermemory CLI

login --print-url prints the authorize link (SUPERMEMORY_AUTHORIZE_URL=…) instead of opening a browser and keeps waiting for the callback. npx supermemory plugin uses it to sign in every selected plugin on one consent screen (https://github.com/supermemoryai/mono/pull/3636, https://github.com/supermemoryai/mono/pull/3637). Verified with all four plugins in one batch against a PR preview.

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.

1 participant