omp-multi-auth 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -5
- package/extensions/lib/providers.ts +21 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -77,7 +77,7 @@ Create `.omp/multi-auth.json` in a project to restrict which subscription provid
|
|
|
77
77
|
| `google-antigravity` | Antigravity |
|
|
78
78
|
| `kimi-code` | Kimi Code |
|
|
79
79
|
| `xai-oauth` | xAI Grok OAuth |
|
|
80
|
-
|
|
80
|
+
| `cursor` | Cursor (browser PKCE OAuth or API key) |
|
|
81
81
|
### API key
|
|
82
82
|
|
|
83
83
|
| Provider | Service |
|
|
@@ -96,14 +96,13 @@ Create `.omp/multi-auth.json` in a project to restrict which subscription provid
|
|
|
96
96
|
| `zai` | Z.AI (GLM) |
|
|
97
97
|
| `minimax` | MiniMax (Global) |
|
|
98
98
|
| `minimax-cn` | MiniMax (China) |
|
|
99
|
+
| `cursor` | Cursor (dashboard API key `crsr_...` / `cursor_...` or browser sign-in) |
|
|
99
100
|
|
|
100
101
|
API-key providers support full multi-account operation. Add an account with `/multi-auth add`, select the provider, then authenticate via `/multi-auth login` (or `/login <name>`) and paste your API key when prompted. Each account stores its own key independently in OMP auth storage.
|
|
101
102
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
GitLab Duo requires custom handlers and is not exposed.
|
|
103
|
+
For `cursor`, `/multi-auth login` prompts for a dashboard API key (`crsr_...`/`cursor_...`). Submit a key to use token exchange, or leave it blank to sign in via browser PKCE OAuth. Both methods refresh automatically.
|
|
105
104
|
|
|
106
|
-
## Built-in
|
|
105
|
+
## Built-in quotas
|
|
107
106
|
|
|
108
107
|
Run `/multi-auth limits` to inspect quota and usage information for supported providers. This currently includes built-in quota checks for Codex and Google providers. Results depend on provider availability and authenticated account state.
|
|
109
108
|
|
|
@@ -118,19 +118,31 @@ async function exchangeCursorApiKey(apiKey: string, signal?: AbortSignal): Promi
|
|
|
118
118
|
return { access: data.accessToken, refresh: apiKey, expires: cursorJwtExpiryMs(data.accessToken) };
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
|
|
121
|
+
const CURSOR_API_KEY_PREFIXES = ["crsr_", "cursor_"];
|
|
122
|
+
|
|
123
|
+
export function buildCursorOAuth(index: number): ProviderOAuth {
|
|
124
|
+
const definition = requireOAuthDefinition("cursor");
|
|
122
125
|
return {
|
|
123
126
|
name: `Cursor #${index}`,
|
|
124
127
|
async login(callbacks: OAuthLoginCallbacks): Promise<OAuthCredentials> {
|
|
125
128
|
const apiKey = (await callbacks.onPrompt({
|
|
126
|
-
message: "Paste your Cursor API key (crsr_...):",
|
|
127
|
-
placeholder: "crsr_...",
|
|
129
|
+
message: "Paste your Cursor API key (crsr_...), or leave blank to sign in with your browser:",
|
|
130
|
+
placeholder: "crsr_... (blank = browser sign-in)",
|
|
131
|
+
allowEmpty: true,
|
|
128
132
|
})).trim();
|
|
129
|
-
if (
|
|
130
|
-
|
|
133
|
+
if (apiKey) return exchangeCursorApiKey(apiKey, callbacks.signal);
|
|
134
|
+
const credentials = await definition.login(callbacks);
|
|
135
|
+
if (typeof credentials === "string") {
|
|
136
|
+
throw new Error(`Cursor #${index} browser login did not return renewable credentials`);
|
|
137
|
+
}
|
|
138
|
+
return credentials;
|
|
131
139
|
},
|
|
132
|
-
async refreshToken(credentials: OAuthCredentials): Promise<OAuthCredentials> {
|
|
133
|
-
|
|
140
|
+
async refreshToken(credentials: OAuthCredentials, signal?: AbortSignal): Promise<OAuthCredentials> {
|
|
141
|
+
const refresh = credentials.refresh || credentials.access;
|
|
142
|
+
if (CURSOR_API_KEY_PREFIXES.some((prefix) => refresh.startsWith(prefix))) {
|
|
143
|
+
return exchangeCursorApiKey(refresh, signal);
|
|
144
|
+
}
|
|
145
|
+
return definition.refreshToken(credentials, signal);
|
|
134
146
|
},
|
|
135
147
|
getApiKey(credentials: OAuthCredentials): string {
|
|
136
148
|
return credentials.access;
|
|
@@ -370,9 +382,9 @@ export const PROVIDER_TEMPLATES: Record<string, ProviderTemplate> = {
|
|
|
370
382
|
},
|
|
371
383
|
|
|
372
384
|
cursor: {
|
|
373
|
-
displayName: "Cursor
|
|
385
|
+
displayName: "Cursor",
|
|
374
386
|
buildOAuth(index: number) {
|
|
375
|
-
return
|
|
387
|
+
return buildCursorOAuth(index);
|
|
376
388
|
},
|
|
377
389
|
},
|
|
378
390
|
|
package/package.json
CHANGED