diff --git a/command/auth.go b/command/auth.go index 642ed03c4..015b5c95c 100644 --- a/command/auth.go +++ b/command/auth.go @@ -87,6 +87,9 @@ func (c *AuthCommand) Run(args []string) int { return 1 } + c.Ui.Output(fmt.Sprintf( + "Successfully authenticated!")) + return 0 } diff --git a/command/meta.go b/command/meta.go index c9c636879..bbeb38be5 100644 --- a/command/meta.go +++ b/command/meta.go @@ -77,7 +77,26 @@ func (m *Meta) Client() (*api.Client, error) { config.HttpClient = &client } - return api.NewClient(config) + // Build the client + client, err := api.NewClient(config) + if err != nil { + return nil, err + } + + // If we have a token, then set that + tokenHelper, err := m.TokenHelper() + if err != nil { + return nil, err + } + token, err := tokenHelper.Get() + if err != nil { + return nil, err + } + if token != "" { + client.SetToken(token) + } + + return client, nil } // Config loads the configuration and returns it. If the configuration