Replace token-paste with native device-code/PKCE provider sign-in

Implement the official OAuth login flows natively (ported from pi-ai's
reference): GitHub Copilot device-code, GPT account (ChatGPT Codex) and
Google Antigravity authorization-code + PKCE via a loopback callback server.
Obtained credentials are stored as JSON through the existing secret vault.
Onboarding and Settings now run the real sign-in instead of pasting an
access token.
This commit is contained in:
ZacharyZhang-NY committed 2026-05-29 20:08:55 -04:00
1 parent d5bf6c6b5f
commit 49a9f16221
24 files changed
+1057 -64

No files matched your search

@@ -96,6 +96,7 @@ export class ProviderService {
providerKey: provider.provider_key,
authType: provider.auth_type,
employeeId: input.employeeId ?? null,
secret,
});
const authProfile = this.authBroker.createProviderProfile({
orgId: input.orgId,
@@ -263,10 +264,16 @@ export class ProviderService {
providerKey: string;
authType: ProviderAuthType;
employeeId: string | null;
secret: string;
}): { sourceType: string; sourceRef: string | null } {
if (input.authType !== PROVIDER_AUTH_TYPE.OAUTH_PKCE && input.authType !== PROVIDER_AUTH_TYPE.ACCOUNT_SUBSCRIPTION) {
return { sourceType: "manual_secret", sourceRef: null };
}
// Credentials obtained through the native OAuth login arrive as a JSON
// object; they are authenticated by the flow itself and need no paste session.
if (input.secret.trim().startsWith("{")) {
return { sourceType: "provider_oauth_login", sourceRef: null };
}
if (!input.employeeId) throw new Error("Provider sign-in employee is required.");
const session = this.db.prepare(`
select id