Skip to content

Commit

Permalink
Make the audience flag required in test token (#221)
Browse files Browse the repository at this point in the history
* Make the audience flag required in `test token`

* Fix help message
  • Loading branch information
Widcket authored Apr 2, 2021
1 parent 536c380 commit fbce21f
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions internal/cli/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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 <id> --audience <audience> --scopes <scope1,scope2>`,
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down Expand Up @@ -228,7 +236,7 @@ auth0 test token --client-id <id> --audience <audience> --scopes <scope1,scope2>

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
}

0 comments on commit fbce21f

Please sign in to comment.