| 437 | } |
| 438 | |
| 439 | func createAppCmd(cli *cli) *cobra.Command { |
| 440 | var inputs struct { |
| 441 | Name string |
| 442 | Type string |
| 443 | Description string |
| 444 | Callbacks []string |
| 445 | AllowedOrigins []string |
| 446 | AllowedWebOrigins []string |
| 447 | AllowedLogoutURLs []string |
| 448 | AuthMethod string |
| 449 | Grants []string |
| 450 | RevealSecrets bool |
| 451 | Metadata map[string]string |
| 452 | RefreshToken string |
| 453 | ResourceServerIdentifier string |
| 454 | AllowAnyProfileOfType []string |
| 455 | IsFirstParty bool |
| 456 | ThirdPartySecurityMode string |
| 457 | RedirectionPolicy string |
| 458 | } |
| 459 | var oidcConformant = true |
| 460 | var algorithm = "RS256" |
| 461 | |
| 462 | cmd := &cobra.Command{ |
| 463 | Use: "create", |
| 464 | Args: cobra.NoArgs, |
| 465 | Short: "Create a new application", |
| 466 | Long: "Create a new application.\n\n" + |
| 467 | "To create interactively, use `auth0 apps create` with no arguments.\n\n" + |
| 468 | "To create non-interactively, supply at least the application name, and type through the flags.", |
| 469 | Example: ` auth0 apps create |
| 470 | auth0 apps create --name myapp |
| 471 | auth0 apps create --name myapp --description <description> |
| 472 | auth0 apps create --name myapp --description <description> --type [native|spa|regular|m2m|resource_server] |
| 473 | auth0 apps create --name myapp --description <description> --type [native|spa|regular|m2m|resource_server] --reveal-secrets |
| 474 | auth0 apps create -n myapp -d <description> -t [native|spa|regular|m2m|resource_server] -r --json |
| 475 | auth0 apps create -n myapp -d <description> -t [native|spa|regular|m2m|resource_server] -r --json-compact |
| 476 | auth0 apps create -n myapp -d <description> -t [native|spa|regular|m2m|resource_server] -r --json --metadata "foo=bar" |
| 477 | auth0 apps create -n myapp -d <description> -t [native|spa|regular|m2m|resource_server] -r --json --metadata "foo=bar" --metadata "bazz=buzz" |
| 478 | auth0 apps create -n myapp -d <description> -t [native|spa|regular|m2m|resource_server] -r --json --metadata "foo=bar,bazz=buzz" |
| 479 | auth0 apps create --name "My API Client" --type resource_server --resource-server-identifier "https://api.example.com" |
| 480 | auth0 apps create --name myapp --type resource_server --allow-any-profile-of-type custom_authentication,on_behalf_of_token_exchange |
| 481 | auth0 apps create --name "My 3P App" --type regular --is-first-party=false --third-party-security-mode strict --redirection-policy open_redirect_protection`, |
| 482 | RunE: func(cmd *cobra.Command, args []string) error { |
| 483 | if err := appName.Ask(cmd, &inputs.Name, nil); err != nil { |
| 484 | return err |
| 485 | } |
| 486 | |
| 487 | if err := appDescription.Ask(cmd, &inputs.Description, nil); err != nil { |
| 488 | return err |
| 489 | } |
| 490 | |
| 491 | if err := appType.Select(cmd, &inputs.Type, appTypeOptions, nil); err != nil { |
| 492 | return err |
| 493 | } |
| 494 | |
| 495 | appIsM2M := apiTypeFor(inputs.Type) == appTypeNonInteractive |
| 496 | appIsNative := apiTypeFor(inputs.Type) == appTypeNative |