mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-14 22:02:59 -07:00
refactor(telemetry): Improve previous PR that allows telemetry to use the CLI auth and add testing (#14589)
This commit is contained in:
committed by
GitHub
parent
8651c53923
commit
4322137cee
@@ -56,6 +56,7 @@ async function triggerPostAuthCallbacks(tokens: Credentials) {
|
||||
client_secret: OAUTH_CLIENT_SECRET,
|
||||
refresh_token: tokens.refresh_token ?? undefined, // Ensure null is not passed
|
||||
type: 'authorized_user',
|
||||
client_email: userAccountManager.getCachedGoogleAccount() ?? undefined,
|
||||
};
|
||||
|
||||
// Execute all registered post-authentication callbacks.
|
||||
@@ -255,6 +256,18 @@ async function initOauthClient(
|
||||
'Failed to authenticate with user code.',
|
||||
);
|
||||
}
|
||||
|
||||
// Retrieve and cache Google Account ID after successful user code auth
|
||||
try {
|
||||
await fetchAndCacheUserInfo(client);
|
||||
} catch (error) {
|
||||
debugLogger.warn(
|
||||
'Failed to retrieve Google Account ID during authentication:',
|
||||
getErrorMessage(error),
|
||||
);
|
||||
}
|
||||
|
||||
await triggerPostAuthCallbacks(client.credentials);
|
||||
} else {
|
||||
const webLogin = await authWithWeb(client);
|
||||
|
||||
@@ -318,6 +331,8 @@ async function initOauthClient(
|
||||
severity: 'info',
|
||||
message: 'Authentication succeeded\n',
|
||||
});
|
||||
|
||||
await triggerPostAuthCallbacks(client.credentials);
|
||||
}
|
||||
|
||||
return client;
|
||||
|
||||
Reference in New Issue
Block a user