diff --git a/pkg/apiserver/apic.go b/pkg/apiserver/apic.go index 009da967b..1abf83057 100644 --- a/pkg/apiserver/apic.go +++ b/pkg/apiserver/apic.go @@ -198,18 +198,20 @@ func NewAPIC(config *csconfig.OnlineApiClientCfg, dbClient *database.Client, con return nil, errors.Wrap(err, "while creating api client") } - scenarios, err := ret.FetchScenariosListFromDB() - if err != nil { - return ret, errors.Wrapf(err, "get scenario in db: %s", err) - } + // The watcher will be authenticated by the RoundTripper the first time it will call CAPI + // Explicit authentication will provoke an useless supplementary call to CAPI + // scenarios, err := ret.FetchScenariosListFromDB() + // if err != nil { + // return ret, errors.Wrapf(err, "get scenario in db: %s", err) + // } - if _, err = ret.apiClient.Auth.AuthenticateWatcher(context.Background(), models.WatcherAuthRequest{ - MachineID: &config.Credentials.Login, - Password: &password, - Scenarios: scenarios, - }); err != nil { - return ret, errors.Wrapf(err, "authenticate watcher (%s)", config.Credentials.Login) - } + // if _, err = ret.apiClient.Auth.AuthenticateWatcher(context.Background(), models.WatcherAuthRequest{ + // MachineID: &config.Credentials.Login, + // Password: &password, + // Scenarios: scenarios, + // }); err != nil { + // return ret, errors.Wrapf(err, "authenticate watcher (%s)", config.Credentials.Login) + // } return ret, err }