From 17080d2354873be5a9b0d2e96d46d769282b8e7b Mon Sep 17 00:00:00 2001 From: Will Vedder Date: Fri, 2 Dec 2022 14:05:56 -0500 Subject: [PATCH] Adding temporary error handler for integration tests --- internal/cli/api.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/cli/api.go b/internal/cli/api.go index 08f2da98e..2c4fa1564 100644 --- a/internal/cli/api.go +++ b/internal/cli/api.go @@ -3,6 +3,7 @@ package cli import ( "bytes" "encoding/json" + "errors" "fmt" "io" "net/http" @@ -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")))