Skip to content

Commit eea4e82

Browse files
authored
[server] improve logging on logins (#17096)
1 parent 94340c7 commit eea4e82

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

components/server/src/auth/generic-auth-provider.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -445,16 +445,18 @@ export class GenericAuthProvider implements AuthProvider {
445445
}
446446

447447
if (flowContext) {
448+
const logPayload = {
449+
withIdentity: TosFlow.WithIdentity.is(flowContext) ? flowContext.candidate : undefined,
450+
withUser: TosFlow.WithUser.is(flowContext) ? User.censor(flowContext.user) : undefined,
451+
...defaultLogPayload,
452+
};
448453
if (
449454
TosFlow.WithIdentity.is(flowContext) ||
450455
(TosFlow.WithUser.is(flowContext) && flowContext.termsAcceptanceRequired)
451456
) {
452457
// This is the regular path on sign up. We just went through the OAuth2 flow but didn't create a Gitpod
453458
// account yet, as we require to accept the terms first.
454-
log.info(context, `(${strategyName}) Redirect to /api/tos`, {
455-
info: flowContext,
456-
...defaultLogPayload,
457-
});
459+
log.info(context, `(${strategyName}) Redirect to /api/tos`, logPayload);
458460

459461
// attach the sign up info to the session, in order to proceed after acceptance of terms
460462
await TosFlow.attach(request.session!, flowContext);
@@ -463,10 +465,7 @@ export class GenericAuthProvider implements AuthProvider {
463465
return;
464466
} else {
465467
const { user, elevateScopes } = flowContext as TosFlow.WithUser;
466-
log.info(context, `(${strategyName}) Directly log in and proceed.`, {
467-
info: flowContext,
468-
...defaultLogPayload,
469-
});
468+
log.info(context, `(${strategyName}) Directly log in and proceed.`, logPayload);
470469

471470
// Complete login
472471
const { host, returnTo } = authFlow;

0 commit comments

Comments
 (0)