Fall back to an available OAuth flow when the preferred one is not configured

This commit is contained in:
Viktor Liu
2026-08-13 17:28:37 +09:00
committed by Viktor Liu
parent e290769df1
commit d9ff306a7c
7 changed files with 588 additions and 71 deletions
+5
View File
@@ -682,6 +682,11 @@ func (s *Server) Login(callerCtx context.Context, msg *proto.LoginRequest) (*pro
oAuthFlow, err := auth.NewOAuthFlow(ctx, config, msg.IsUnixDesktopClient, false, hint)
if err != nil {
state.Set(internal.StatusLoginFailed)
// enrolling a device is the one flow a setup key can replace. NotFound so the CLI
// stops its backoff loop and shows this instead of retrying a permanent condition.
if auth.IsSSOUnavailable(err) {
return nil, gstatus.Error(codes.NotFound, auth.WithSetupKeyAdvice(err).Error())
}
return nil, err
}