| 509 | } |
| 510 | |
| 511 | func (c *cli) organizationPickerOptionsForGrant(audience string) pickerOptionsFunc { |
| 512 | return func(ctx context.Context) (pickerOptions, error) { |
| 513 | orgList, err := c.api.Organization.List(ctx) |
| 514 | if err != nil { |
| 515 | return nil, err |
| 516 | } |
| 517 | |
| 518 | if len(orgList.Organizations) == 0 { |
| 519 | return nil, fmt.Errorf( |
| 520 | "the client grant for %s requires an organization, but no organizations exist on this tenant.\n\n"+ |
| 521 | "Create one by running: 'auth0 orgs create'", |
| 522 | ansi.Bold(audience), |
| 523 | ) |
| 524 | } |
| 525 | |
| 526 | var opts pickerOptions |
| 527 | for _, org := range orgList.Organizations { |
| 528 | label := fmt.Sprintf("%s %s", org.GetName(), ansi.Faint("("+org.GetID()+")")) |
| 529 | opts = append(opts, pickerOption{value: org.GetID(), label: label}) |
| 530 | } |
| 531 | return opts, nil |
| 532 | } |
| 533 | } |
| 534 | |
| 535 | func (c *cli) pickTokenScopes(ctx context.Context, inputs *testCmdInputs) error { |
| 536 | resourceServer, err := c.api.ResourceServer.Read(ctx, inputs.Audience) |