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