| 1425 | } |
| 1426 | |
| 1427 | func generateClient(input SetupInputs, reqParams auth0.RequestParams) (*management.Client, error) { |
| 1428 | if input.Name == "" { |
| 1429 | input.Name = "My App" |
| 1430 | } |
| 1431 | |
| 1432 | if input.MetaData == nil { |
| 1433 | input.MetaData = map[string]interface{}{ |
| 1434 | "created_by": "quickstart-docs-manual-cli", |
| 1435 | } |
| 1436 | } |
| 1437 | |
| 1438 | resolved := resolveRequestParams(reqParams, input.Name, input.Port) |
| 1439 | |
| 1440 | // Override URL fields with explicit flag values when provided. |
| 1441 | if input.CallbackURL != "" { |
| 1442 | resolved.Callbacks = []string{input.CallbackURL} |
| 1443 | } |
| 1444 | if input.LogoutURL != "" { |
| 1445 | resolved.AllowedLogoutURLs = []string{input.LogoutURL} |
| 1446 | } |
| 1447 | if input.WebOriginURL != "" { |
| 1448 | resolved.WebOrigins = []string{input.WebOriginURL} |
| 1449 | } |
| 1450 | |
| 1451 | algorithm := "RS256" |
| 1452 | oidcConformant := true |
| 1453 | client := &management.Client{ |
| 1454 | Name: &input.Name, |
| 1455 | AppType: &resolved.AppType, |
| 1456 | Callbacks: &resolved.Callbacks, |
| 1457 | AllowedLogoutURLs: &resolved.AllowedLogoutURLs, |
| 1458 | OIDCConformant: &oidcConformant, |
| 1459 | JWTConfiguration: &management.ClientJWTConfiguration{ |
| 1460 | Algorithm: &algorithm, |
| 1461 | }, |
| 1462 | ClientMetadata: &input.MetaData, |
| 1463 | } |
| 1464 | |
| 1465 | if len(resolved.WebOrigins) > 0 { |
| 1466 | client.WebOrigins = &resolved.WebOrigins |
| 1467 | } |
| 1468 | |
| 1469 | return client, nil |
| 1470 | } |
| 1471 | |
| 1472 | // resolveRequestParams replaces DetectionSub placeholders in RequestParams fields |
| 1473 | // with actual values derived from the user inputs. |