mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-17 08:41:19 -07:00
inlining recordGoogleAuthEnd
This commit is contained in:
@@ -117,12 +117,6 @@ async function initOauthClient(
|
|||||||
authType: AuthType,
|
authType: AuthType,
|
||||||
config: Config,
|
config: Config,
|
||||||
): Promise<AuthClient> {
|
): Promise<AuthClient> {
|
||||||
const recordGoogleAuthEndIfApplicable = () => {
|
|
||||||
if (authType === AuthType.LOGIN_WITH_GOOGLE) {
|
|
||||||
recordGoogleAuthEnd(config);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const credentials = await fetchCachedCredentials();
|
const credentials = await fetchCachedCredentials();
|
||||||
|
|
||||||
if (
|
if (
|
||||||
@@ -167,6 +161,9 @@ async function initOauthClient(
|
|||||||
access_token: process.env['GOOGLE_CLOUD_ACCESS_TOKEN'],
|
access_token: process.env['GOOGLE_CLOUD_ACCESS_TOKEN'],
|
||||||
});
|
});
|
||||||
await fetchAndCacheUserInfo(client);
|
await fetchAndCacheUserInfo(client);
|
||||||
|
if (authType === AuthType.LOGIN_WITH_GOOGLE) {
|
||||||
|
recordGoogleAuthEnd(config);
|
||||||
|
}
|
||||||
return client;
|
return client;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,7 +200,9 @@ async function initOauthClient(
|
|||||||
debugLogger.log('Loaded cached credentials.');
|
debugLogger.log('Loaded cached credentials.');
|
||||||
await triggerPostAuthCallbacks(credentials as Credentials);
|
await triggerPostAuthCallbacks(credentials as Credentials);
|
||||||
|
|
||||||
recordGoogleAuthEndIfApplicable();
|
if (authType === AuthType.LOGIN_WITH_GOOGLE) {
|
||||||
|
recordGoogleAuthEnd(config);
|
||||||
|
}
|
||||||
return client;
|
return client;
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -295,7 +294,9 @@ async function initOauthClient(
|
|||||||
}
|
}
|
||||||
|
|
||||||
await triggerPostAuthCallbacks(client.credentials);
|
await triggerPostAuthCallbacks(client.credentials);
|
||||||
recordGoogleAuthEndIfApplicable();
|
if (authType === AuthType.LOGIN_WITH_GOOGLE) {
|
||||||
|
recordGoogleAuthEnd(config);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// In ACP mode, we skip the interactive consent and directly open the browser
|
// In ACP mode, we skip the interactive consent and directly open the browser
|
||||||
if (!config.getAcpMode()) {
|
if (!config.getAcpMode()) {
|
||||||
@@ -402,7 +403,9 @@ async function initOauthClient(
|
|||||||
});
|
});
|
||||||
|
|
||||||
await triggerPostAuthCallbacks(client.credentials);
|
await triggerPostAuthCallbacks(client.credentials);
|
||||||
recordGoogleAuthEndIfApplicable();
|
if (authType === AuthType.LOGIN_WITH_GOOGLE) {
|
||||||
|
recordGoogleAuthEnd(config);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return client;
|
return client;
|
||||||
|
|||||||
Reference in New Issue
Block a user