Skip to content

Commit

Permalink
Prompt for allowed origins on SPA creation/update (#203)
Browse files Browse the repository at this point in the history
  • Loading branch information
Widcket authored Mar 27, 2021
1 parent cae65f6 commit 574d307
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions internal/cli/apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ var (
ShortForm: "o",
Help: "Comma-separated list of URLs allowed to make requests from JavaScript to Auth0 API (typically used with CORS). By default, all your callback URLs will be allowed. This field allows you to enter other origins if necessary. You can also use wildcards at the subdomain level (e.g., https://*.contoso.com). Query strings and hash information are not taken into account when validating these URLs.",
IsRequired: false,
AlwaysPrompt: true,
}
appWebOrigins = Flag{
Name: "Allowed Web Origin URLs",
Expand Down Expand Up @@ -305,6 +306,15 @@ auth0 apps create --name myapp --type [native|spa|regular|m2m]
}
}

// Prompt for allowed origins URLs if app is SPA
if appIsSPA {
defaultValue := appDefaultURL

if err := appOrigins.AskMany(cmd, &inputs.AllowedOrigins, &defaultValue); err != nil {
return err
}
}

// Prompt for allowed web origins URLs if app is SPA
if appIsSPA {
defaultValue := appDefaultURL
Expand Down Expand Up @@ -458,6 +468,19 @@ auth0 apps update <id> --name myapp --type [native|spa|regular|m2m]
}
}

// Prompt for allowed origins URLs if app is SPA
if appIsSPA {
defaultValue := appDefaultURL

if len(current.AllowedOrigins) > 0 {
defaultValue = stringSliceToCommaSeparatedString(interfaceToStringSlice(current.AllowedOrigins))
}

if err := appOrigins.AskManyU(cmd, &inputs.AllowedOrigins, &defaultValue); err != nil {
return err
}
}

// Prompt for allowed web origins URLs if app is SPA
if appIsSPA {
defaultValue := appDefaultURL
Expand Down

0 comments on commit 574d307

Please sign in to comment.