feat: use email-based profile IDs for OAuth providers
Changes writeOAuthCredentials and applyAuthProfileConfig calls to use the email from OAuth response as part of the profile ID instead of hardcoded ":default". This enables multiple accounts per provider - each login creates a separate profile (e.g., google-antigravity:user@gmail.com) instead of overwriting the same :default profile. Affected files: - src/commands/onboard-auth.ts (generic writeOAuthCredentials) - src/commands/configure.ts (Antigravity flow) - src/wizard/onboarding.ts (Antigravity flow)
This commit is contained in:
@@ -323,7 +323,7 @@ async function promptAuthConfig(
|
||||
if (oauthCreds) {
|
||||
await writeOAuthCredentials("google-antigravity", oauthCreds);
|
||||
next = applyAuthProfileConfig(next, {
|
||||
profileId: "google-antigravity:default",
|
||||
profileId: `google-antigravity:${oauthCreds.email ?? "default"}`,
|
||||
provider: "google-antigravity",
|
||||
mode: "oauth",
|
||||
});
|
||||
|
||||
@@ -7,7 +7,7 @@ export async function writeOAuthCredentials(
|
||||
creds: OAuthCredentials,
|
||||
): Promise<void> {
|
||||
upsertAuthProfile({
|
||||
profileId: `${provider}:default`,
|
||||
profileId: `${provider}:${creds.email ?? "default"}`,
|
||||
credential: {
|
||||
type: "oauth",
|
||||
provider,
|
||||
|
||||
@@ -462,7 +462,7 @@ export async function runOnboardingWizard(
|
||||
if (oauthCreds) {
|
||||
await writeOAuthCredentials("google-antigravity", oauthCreds);
|
||||
nextConfig = applyAuthProfileConfig(nextConfig, {
|
||||
profileId: "google-antigravity:default",
|
||||
profileId: `google-antigravity:${oauthCreds.email ?? "default"}`,
|
||||
provider: "google-antigravity",
|
||||
mode: "oauth",
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user