diff --git a/command/base_predict.go b/command/base_predict.go index 3b59147bb7..9312ac163d 100644 --- a/command/base_predict.go +++ b/command/base_predict.go @@ -21,7 +21,21 @@ func NewPredict() *Predict { func (p *Predict) Client() *api.Client { p.clientOnce.Do(func() { if p.client == nil { // For tests - p.client, _ = api.NewClient(nil) + client, _ := api.NewClient(nil) + + if client.Token() == "" { + helper, err := DefaultTokenHelper() + if err != nil { + return + } + token, err := helper.Get() + if err != nil { + return + } + client.SetToken(token) + } + + p.client = client } }) return p.client