Q178: the Chinese UI labels stored values and sign-in prompts, and shortcuts follow the platform
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f79e3d4d7c
commit
1cc67c244e
28 files changed
+158
-52
No files matched your search
@@ -294,10 +294,10 @@ export function registerIpcHandlers(deps: IpcDeps): void {
|
||||
const secret = await providerOAuth.run(
|
||||
{ providerKey: input.providerKey, enterpriseDomain: input.enterpriseDomain ?? null },
|
||||
{
|
||||
onAuth: ({ url, instructions }) => {
|
||||
onAuth: ({ url, userCode }) => {
|
||||
const browserUrl = normalizeExternalBrowserUrl(url);
|
||||
void shell.openExternal(browserUrl);
|
||||
emit({ phase: "authorize", url: browserUrl, instructions });
|
||||
emit({ phase: "authorize", url: browserUrl, userCode });
|
||||
},
|
||||
onProgress: (message) => emit({ phase: "progress", message }),
|
||||
},
|
||||
|
||||
@@ -75,7 +75,7 @@ export const anthropicClaudeFlow: OAuthFlow = {
|
||||
const { verifier, challenge } = generatePkce();
|
||||
const server = await startOAuthCallbackServer({ port: CALLBACK_PORT, path: CALLBACK_PATH, signal: callbacks.signal });
|
||||
try {
|
||||
callbacks.onAuth({ url: buildAuthorizeUrl(challenge, verifier), instructions: "Complete the Claude sign-in in your browser." });
|
||||
callbacks.onAuth({ url: buildAuthorizeUrl(challenge, verifier), userCode: null });
|
||||
const result = await server.waitForCode();
|
||||
if (result.state !== verifier) throw new Error("OAuth state mismatch.");
|
||||
return await exchangeCode(result.code, result.state, verifier, callbacks.signal);
|
||||
|
||||
@@ -216,7 +216,7 @@ export const githubCopilotFlow: OAuthFlow = {
|
||||
const device = await startDeviceFlow(domain, callbacks.signal);
|
||||
callbacks.onAuth({
|
||||
url: device.verification_uri,
|
||||
instructions: `Enter code ${device.user_code} at ${device.verification_uri}`,
|
||||
userCode: device.user_code,
|
||||
});
|
||||
const githubToken = await pollForGitHubAccessToken(domain, device, callbacks.signal);
|
||||
const credentials = await refreshGitHubCopilotToken(githubToken, enterpriseDomain ?? undefined, callbacks.signal);
|
||||
|
||||
@@ -140,7 +140,7 @@ export const antigravityFlow: OAuthFlow = {
|
||||
const { verifier, challenge } = generatePkce();
|
||||
const server = await startOAuthCallbackServer({ port: CALLBACK_PORT, path: CALLBACK_PATH, signal: callbacks.signal });
|
||||
try {
|
||||
callbacks.onAuth({ url: buildAuthorizeUrl(challenge, verifier), instructions: "Complete the Google sign-in in your browser." });
|
||||
callbacks.onAuth({ url: buildAuthorizeUrl(challenge, verifier), userCode: null });
|
||||
const result = await server.waitForCode();
|
||||
if (result.state !== verifier) throw new Error("OAuth state mismatch.");
|
||||
const tokens = await exchangeCode(result.code, verifier, clientSecret, callbacks.signal);
|
||||
|
||||
@@ -183,7 +183,7 @@ export const kimiCodeFlow: OAuthFlow = {
|
||||
const device = await requestDeviceAuthorization(callbacks.signal);
|
||||
callbacks.onAuth({
|
||||
url: device.verification_uri_complete,
|
||||
instructions: `Approve code ${device.user_code} in your browser to link your Kimi plan.`,
|
||||
userCode: device.user_code,
|
||||
});
|
||||
return pollForToken(device, callbacks.signal);
|
||||
},
|
||||
|
||||
@@ -15,9 +15,8 @@ export interface OAuthCredentials {
|
||||
}
|
||||
|
||||
export interface OAuthLoginCallbacks {
|
||||
/** Called once the authorization URL is ready. `instructions` carries the
|
||||
* device user-code (device flow) or a short note (authorization-code flow). */
|
||||
onAuth: (info: { url: string; instructions?: string }) => void;
|
||||
/** Called once the authorization URL is ready; `userCode` is the device-flow code the user enters, null for a browser redirect. */
|
||||
onAuth: (info: { url: string; userCode: string | null }) => void;
|
||||
onProgress?: (message: string) => void;
|
||||
signal?: AbortSignal;
|
||||
/** GitHub Enterprise domain for Copilot; null/empty means github.com. */
|
||||
|
||||
@@ -99,7 +99,7 @@ export const openaiCodexFlow: OAuthFlow = {
|
||||
const state = generatePkce().verifier;
|
||||
const server = await startOAuthCallbackServer({ port: CALLBACK_PORT, path: CALLBACK_PATH, signal: callbacks.signal });
|
||||
try {
|
||||
callbacks.onAuth({ url: buildAuthorizeUrl(challenge, state), instructions: "Complete the ChatGPT sign-in in your browser." });
|
||||
callbacks.onAuth({ url: buildAuthorizeUrl(challenge, state), userCode: null });
|
||||
const result = await server.waitForCode();
|
||||
if (result.state !== state) throw new Error("OAuth state mismatch.");
|
||||
const tokens = await exchangeCode(result.code, verifier, callbacks.signal);
|
||||
|
||||
@@ -2,7 +2,7 @@ import { getOAuthFlow } from "./oauth/oauth-flows";
|
||||
import type { IntegrationKeyStore } from "./integration-key-store";
|
||||
|
||||
export interface ProviderOAuthHooks {
|
||||
onAuth: (info: { url: string; instructions?: string }) => void;
|
||||
onAuth: (info: { url: string; userCode: string | null }) => void;
|
||||
onProgress?: (message: string) => void;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user