Check if the cancel function was set before using it (#893)

in some cases an IDP device flow expiration time might be shorter than 90s
we should check if the cancel context was set before using it

We will need a follow-up to identify and document the IDP with lower defaults.

fixes #890
This commit is contained in:
Maycon Santos 2023-05-23 17:54:47 +02:00 committed by GitHub
parent f66574b094
commit a91297d3a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -236,9 +236,11 @@ func (s *Server) Login(callerCtx context.Context, msg *proto.LoginRequest) (*pro
}, nil }, nil
} else { } else {
log.Warnf("canceling previous waiting execution") log.Warnf("canceling previous waiting execution")
if s.oauthAuthFlow.waitCancel != nil {
s.oauthAuthFlow.waitCancel() s.oauthAuthFlow.waitCancel()
} }
} }
}
deviceAuthInfo, err := hostedClient.RequestDeviceCode(context.TODO()) deviceAuthInfo, err := hostedClient.RequestDeviceCode(context.TODO())
if err != nil { if err != nil {