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) {
|
if (oauthCreds) {
|
||||||
await writeOAuthCredentials("google-antigravity", oauthCreds);
|
await writeOAuthCredentials("google-antigravity", oauthCreds);
|
||||||
next = applyAuthProfileConfig(next, {
|
next = applyAuthProfileConfig(next, {
|
||||||
profileId: "google-antigravity:default",
|
profileId: `google-antigravity:${oauthCreds.email ?? "default"}`,
|
||||||
provider: "google-antigravity",
|
provider: "google-antigravity",
|
||||||
mode: "oauth",
|
mode: "oauth",
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ export async function writeOAuthCredentials(
|
|||||||
creds: OAuthCredentials,
|
creds: OAuthCredentials,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
upsertAuthProfile({
|
upsertAuthProfile({
|
||||||
profileId: `${provider}:default`,
|
profileId: `${provider}:${creds.email ?? "default"}`,
|
||||||
credential: {
|
credential: {
|
||||||
type: "oauth",
|
type: "oauth",
|
||||||
provider,
|
provider,
|
||||||
|
|||||||
@@ -462,7 +462,7 @@ export async function runOnboardingWizard(
|
|||||||
if (oauthCreds) {
|
if (oauthCreds) {
|
||||||
await writeOAuthCredentials("google-antigravity", oauthCreds);
|
await writeOAuthCredentials("google-antigravity", oauthCreds);
|
||||||
nextConfig = applyAuthProfileConfig(nextConfig, {
|
nextConfig = applyAuthProfileConfig(nextConfig, {
|
||||||
profileId: "google-antigravity:default",
|
profileId: `google-antigravity:${oauthCreds.email ?? "default"}`,
|
||||||
provider: "google-antigravity",
|
provider: "google-antigravity",
|
||||||
mode: "oauth",
|
mode: "oauth",
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user