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

This commit is contained in:
Viktor Liu
2026-08-12 18:56:47 +02:00
parent f27a0935bf
commit 9230ebf85d
7 changed files with 588 additions and 71 deletions

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
}