Skip to content

Commit

Permalink
Adding temporary error handler for integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
willvedd committed Dec 2, 2022
1 parent 4173fa2 commit 17080d2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/cli/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cli
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io"
"net/http"
Expand Down Expand Up @@ -130,6 +131,11 @@ func apiCmdRun(cli *cli, inputs *apiCmdInputs) func(cmd *cobra.Command, args []s
}

bearerToken := cli.config.Tenants[cli.tenant].AccessToken

if bearerToken == "" {
return errors.New("missing access token associated with tenant. Please re-authenticate by running `auth0 login`")
}

request.Header.Set("Authorization", fmt.Sprintf("Bearer %s", bearerToken))
request.Header.Set("Content-Type", "application/json")
request.Header.Set("User-Agent", fmt.Sprintf("%s/%s", userAgent, strings.TrimPrefix(buildinfo.Version, "v")))
Expand Down

0 comments on commit 17080d2

Please sign in to comment.