Skip to content

Commit

Permalink
feat: revoke kratos session asynchronously
Browse files Browse the repository at this point in the history
  • Loading branch information
alnr committed Feb 5, 2025
1 parent 2bf76ce commit 6657148
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions consent/strategy_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -1015,11 +1015,13 @@ func (s *DefaultStrategy) performBackChannelLogoutAndDeleteSession(r *http.Reque
} else if err != nil {
return err
} else {
innerErr := s.r.Kratos().DisableSession(ctx, session.IdentityProviderSessionID.String())
if innerErr != nil {
s.r.Logger().WithError(innerErr).WithField("sid", sid).Error("Unable to revoke session in ORY Kratos.")
}
// We don't return the error here because we don't want to break the logout flow if Kratos is down.
// revoke Kratos session asynchronously
go func(ctx context.Context, kratosSessionID string) {
innerErr := s.r.Kratos().DisableSession(ctx, kratosSessionID)
if innerErr != nil {
s.r.Logger().WithError(innerErr).WithField("sid", sid).WithField("kratos-sid", kratosSessionID).Error("Unable to revoke session in Ory Kratos.")
}
}(context.WithoutCancel(ctx), session.IdentityProviderSessionID.String())
}

return nil
Expand Down

0 comments on commit 6657148

Please sign in to comment.