Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the audience flag required in test token #221

Merged
merged 3 commits into from
Apr 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}