Documentation
¶
Overview ¶
Package auth0 provides a client for using the Auth0 Management API.
Usage
import (
github.com/auth0/go-auth0
github.com/auth0/go-auth0/management
)
Initialize a new client using a domain, client ID and secret.
m, err := management.New(domain, management.WithClientCredentials(id, secret))
if err != nil {
// handle err
}
Or using a static token.
m, err := management.New(domain, management.WithStaticToken(token))
if err != nil {
// handle err
}
With a management client we can then interact with the Auth0 Management API.
c := &management.Client{
Name: auth0.String("Client Name"),
Description: auth0.String("Long description of client"),
}
err = m.Client.Create(c)
if err != nil {
// handle err
}
Authentication ¶
The auth0 package handles authentication by exchanging the client id and secret supplied when creating a new management client.
This is handled internally using the https://godoc.org/golang.org/x/oauth2 package.
Rate Limiting ¶
The auth0 package also handles rate limiting by respecting the `X-Ratelimit-*` headers sent by the server.
The amount of time the client waits for the rate limit to be reset is taken from the `X-Ratelimit-Reset` header as the amount of seconds to wait.
Configuration ¶
There are several other options that can be specified during the creation of a new client.
m, err := management.New(domain,
management.WithClientCredentials(id, secret),
management.WithContext(context.Background()),
management.WithDebug(true))
Request Options ¶
As with the global client configuration, fine grained configuration can be done on a request basis.
c, err := m.Connection.List(
management.Context(ctx),
management.Page(2),
management.PerPage(10),
management.IncludeFields("id", "name", "options")
management.Parameter("strategy", "auth0"),
)
Index ¶
- Variables
- func Bool(b bool) *bool
- func BoolValue(b *bool) bool
- func Float64(f float64) *float64
- func Float64Value(f *float64) float64
- func Int(i int) *int
- func IntValue(i *int) int
- func String(s string) *string
- func StringValue(v *string) string
- func Stringf(s string, v ...interface{}) *string
- func Time(t time.Time) *time.Time
- func TimeValue(t *time.Time) time.Time
Constants ¶
This section is empty.
Variables ¶
var Version = "0.10.1"
Version of this library. This value is generated automatically during the release process; DO NOT EDIT.
Functions ¶
func BoolValue ¶
BoolValue returns the value of the bool pointer passed in or false if the pointer is nil.
func Float64Value ¶
Float64Value returns the value of the float64 pointer passed in or 0 if the pointer is nil.
func StringValue ¶
StringValue returns the value of the string pointer passed in or "" if the pointer is nil.
Types ¶
This section is empty.