inlining recordGoogleAuthEnd
This commit is contained in:
parent
192b1a630f
commit
2bd1d45f08
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user