MCPcopy Create free account
hub / github.com/auth0/auth0-cli / initializeManagementClientV2

Function initializeManagementClientV2

internal/cli/management.go:35–48  ·  view source on GitHub ↗
(tenantDomain string, accessToken string)

Source from the content-addressed store, hash-verified

33}
34
35func initializeManagementClientV2(tenantDomain string, accessToken string) (*managementv2.Management, error) {
36 client, err := managementv2.New(
37 tenantDomain,
38 option.WithToken(accessToken),
39 option.WithUserAgent(fmt.Sprintf("%v/%v", userAgent, strings.TrimPrefix(buildinfo.Version, "v"))),
40 option.WithAuth0ClientEnvEntry("Auth0-CLI", strings.TrimPrefix(buildinfo.Version, "v")),
41 // If not set, it defaults to 2 as per v2@v2.5.0/management/internal/retrier.go:43.
42 // Setting it to 1 to avoid retries from `go-auth0` since we have our own retry logic in the custom HTTP client.
43 // TODO: confirm this assumption, or check if this needs to be excluded like terraform provider.
44 option.WithMaxAttempts(1),
45 option.WithHTTPClient(customClientWithRetries()),
46 )
47 return client, err
48}
49
50func customClientWithRetries() *http.Client {
51 client := &http.Client{

Callers 1

Calls 1

customClientWithRetriesFunction · 0.85

Tested by

no test coverage detected