From fbce21f8133d3673d0d6badf7a10a98363ed9604 Mon Sep 17 00:00:00 2001 From: Rita Zerrizuela Date: Fri, 2 Apr 2021 15:32:51 -0300 Subject: [PATCH] Make the audience flag required in `test token` (#221) * Make the audience flag required in `test token` * Fix help message --- internal/cli/test.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/internal/cli/test.go b/internal/cli/test.go index 02c6ea9bc..f2971b065 100644 --- a/internal/cli/test.go +++ b/internal/cli/test.go @@ -26,7 +26,15 @@ var ( Name: "Audience", LongForm: "audience", ShortForm: "a", - Help: "The unique identifier of the target Audience you want to access.", + Help: "The unique identifier of the target API you want to access.", + } + + testAudienceRequired = Flag{ + Name: testAudience.Name, + LongForm: testAudience.LongForm, + ShortForm: testAudience.ShortForm, + Help: testAudience.Help, + IsRequired: true, } testScopes = Flag{ @@ -157,7 +165,7 @@ func testTokenCmd(cli *cli) *cobra.Command { Short: "Fetch a token for the given client and API", Long: `Fetch an access token for the given client. If --client-id is not provided, the default client "CLI Login Testing" will be used (and created if not exists). -Additionally, you can also specify the --audience and --scope to use.`, +Specify the API you want this token for with --audience (API Identifer). Additionally, you can also specify the --scope to use.`, Example: `auth0 test token auth0 test token --client-id --audience --scopes `, RunE: func(cmd *cobra.Command, args []string) error { @@ -228,7 +236,7 @@ auth0 test token --client-id --audience --scopes cmd.SetUsageTemplate(resourceUsageTemplate()) testClientID.RegisterString(cmd, &inputs.ClientID, "") - testAudience.RegisterString(cmd, &inputs.Audience, "") + testAudienceRequired.RegisterString(cmd, &inputs.Audience, "") testScopes.RegisterStringSlice(cmd, &inputs.Scopes, nil) return cmd }