Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/auth0/go-auth0/llms.txt

Use this file to discover all available pages before exploring further.

Clients represent applications or SSO integrations in Auth0. Use this API to create, configure, and manage your applications.

List Clients

Retrieves a paginated list of clients (applications) matching the provided filters.
func (c *Client) List(
    ctx context.Context,
    request *management.ListClientsRequestParameters,
    opts ...option.RequestOption,
) (*core.Page[*int, *management.Client, *management.ListClientsOffsetPaginatedResponseContent], error)
ctx
context.Context
required
Context for the request
request
*management.ListClientsRequestParameters
Query parameters:
  • Fields - Fields to include or exclude
  • IncludeFields - Whether to include or exclude fields
  • Page - Page number (default: 0)
  • PerPage - Number of results per page (default: 50, max: 100)
  • IncludeTotals - Include total count (default: true)
  • IsGlobal - Filter by global clients
  • IsFirstParty - Filter by first-party clients
  • AppType - Filter by application type
opts
...option.RequestOption
Optional request options

Example

import (
    "context"
    "fmt"
    "log"

    "github.com/auth0/go-auth0/v2/management"
)

params := &management.ListClientsRequestParameters{
    PerPage: management.Int(25),
    AppType: []string{"regular_web", "spa"},
}

page, err := client.Management.Clients.List(context.TODO(), params)
if err != nil {
    log.Fatalf("Failed to list clients: %v", err)
}

for _, app := range page.Results {
    fmt.Printf("Client: %s (ID: %s)\n", app.GetName(), app.GetClientID())
}

Get Client

Retrieves details for a specific client by ID.
func (c *Client) Get(
    ctx context.Context,
    id string,
    request *management.GetClientRequestParameters,
    opts ...option.RequestOption,
) (*management.GetClientResponseContent, error)
ctx
context.Context
required
Context for the request
id
string
required
ID of the client to retrieve
request
*management.GetClientRequestParameters
Query parameters:
  • Fields - Fields to include or exclude
  • IncludeFields - Whether to include or exclude fields
opts
...option.RequestOption
Optional request options
client
*management.GetClientResponseContent
Returns the client with properties:
  • ClientID - Unique client identifier
  • Name - Client name
  • Description - Client description
  • AppType - Application type
  • LogoURI - Logo URL
  • Callbacks - Allowed callback URLs
  • AllowedOrigins - Allowed origins
  • WebOrigins - Allowed web origins
  • GrantTypes - Allowed grant types
  • JwtConfiguration - JWT configuration
  • ClientSecret - Client secret (if authorized)

Example

app, err := client.Management.Clients.Get(
    context.TODO(),
    "abc123xyz",
    &management.GetClientRequestParameters{},
)
if err != nil {
    log.Fatalf("Failed to get client: %v", err)
}

fmt.Printf("Client: %s\n", app.GetName())
fmt.Printf("Type: %s\n", app.GetAppType())

Create Client

Creates a new client (application or SSO integration).
func (c *Client) Create(
    ctx context.Context,
    request *management.CreateClientRequestContent,
    opts ...option.RequestOption,
) (*management.CreateClientResponseContent, error)
ctx
context.Context
required
Context for the request
request
*management.CreateClientRequestContent
required
The client configuration:
  • Name - Client name (required)
  • Description - Client description
  • AppType - Application type (e.g., “regular_web”, “spa”, “native”)
  • LogoURI - Logo URL
  • Callbacks - Allowed callback URLs
  • AllowedOrigins - Allowed origins
  • WebOrigins - Allowed web origins
  • GrantTypes - Allowed grant types
  • JwtConfiguration - JWT configuration
  • TokenEndpointAuthMethod - Token endpoint auth method
opts
...option.RequestOption
Optional request options

Example

app := &management.CreateClientRequestContent{
    Name: "My Application",
    Description: management.String("My web application"),
    AppType: management.String("regular_web"),
    Callbacks: []string{
        "https://myapp.com/callback",
        "https://myapp.com/auth/callback",
    },
    AllowedOrigins: []string{"https://myapp.com"},
    WebOrigins: []string{"https://myapp.com"},
    GrantTypes: []string{"authorization_code", "refresh_token"},
    JwtConfiguration: &management.ClientJwtConfiguration{
        Alg: management.String("RS256"),
        LifetimeInSeconds: management.Int(36000),
    },
}

created, err := client.Management.Clients.Create(context.TODO(), app)
if err != nil {
    log.Fatalf("Failed to create client: %v", err)
}

fmt.Printf("Created client ID: %s\n", created.GetClientID())
fmt.Printf("Client secret: %s\n", created.GetClientSecret())

Update Client

Updates an existing client’s settings.
func (c *Client) Update(
    ctx context.Context,
    id string,
    request *management.UpdateClientRequestContent,
    opts ...option.RequestOption,
) (*management.UpdateClientResponseContent, error)
ctx
context.Context
required
Context for the request
id
string
required
ID of the client to update
request
*management.UpdateClientRequestContent
required
The fields to update
opts
...option.RequestOption
Optional request options

Example

update := &management.UpdateClientRequestContent{
    Name: management.String("Updated Application Name"),
    Callbacks: []string{
        "https://myapp.com/callback",
        "https://myapp.com/new-callback",
    },
    JwtConfiguration: &management.ClientJwtConfiguration{
        LifetimeInSeconds: management.Int(7200),
    },
}

updated, err := client.Management.Clients.Update(
    context.TODO(),
    "abc123xyz",
    update,
)
if err != nil {
    log.Fatalf("Failed to update client: %v", err)
}

Delete Client

Deletes a client and its related configuration.
func (c *Client) Delete(
    ctx context.Context,
    id string,
    opts ...option.RequestOption,
) error
ctx
context.Context
required
Context for the request
id
string
required
ID of the client to delete
opts
...option.RequestOption
Optional request options

Example

err := client.Management.Clients.Delete(context.TODO(), "abc123xyz")
if err != nil {
    log.Fatalf("Failed to delete client: %v", err)
}

Rotate Client Secret

Rotates a client’s secret, generating a new one.
func (c *Client) RotateSecret(
    ctx context.Context,
    id string,
    opts ...option.RequestOption,
) (*management.RotateClientSecretResponseContent, error)
ctx
context.Context
required
Context for the request
id
string
required
ID of the client to rotate secrets for
opts
...option.RequestOption
Optional request options

Example

rotated, err := client.Management.Clients.RotateSecret(
    context.TODO(),
    "abc123xyz",
)
if err != nil {
    log.Fatalf("Failed to rotate secret: %v", err)
}

fmt.Printf("New client secret: %s\n", rotated.GetClientSecret())

Application Types

Auth0 supports several application types:
  • native - Native/mobile applications
  • spa - Single-page applications
  • regular_web - Regular web applications
  • non_interactive - Machine-to-machine applications

Complete Example

package main

import (
    "context"
    "fmt"
    "log"
    "os"

    "github.com/auth0/go-auth0/v2/management"
)

func main() {
    client, err := management.New(
        context.TODO(),
        os.Getenv("AUTH0_DOMAIN"),
        management.WithClientCredentials(
            os.Getenv("AUTH0_CLIENT_ID"),
            os.Getenv("AUTH0_CLIENT_SECRET"),
        ),
    )
    if err != nil {
        log.Fatalf("Failed to create client: %v", err)
    }

    // Create a new SPA client
    app := &management.CreateClientRequestContent{
        Name: "My SPA",
        AppType: management.String("spa"),
        Callbacks: []string{"https://myapp.com/callback"},
        AllowedOrigins: []string{"https://myapp.com"},
        GrantTypes: []string{"authorization_code", "refresh_token"},
    }

    created, err := client.Management.Clients.Create(context.TODO(), app)
    if err != nil {
        log.Fatalf("Failed to create client: %v", err)
    }

    fmt.Printf("Created client: %s\n", created.GetClientID())

    // Update the client
    update := &management.UpdateClientRequestContent{
        Description: management.String("Updated description"),
    }

    _, err = client.Management.Clients.Update(
        context.TODO(),
        created.GetClientID(),
        update,
    )
    if err != nil {
        log.Fatalf("Failed to update client: %v", err)
    }

    fmt.Println("Client updated successfully")
}

Build docs developers (and LLMs) love