Go client library for the Auth0 platform.
Note: This SDK was previously maintained under go-auth0/auth0.
- Installation
- Documentation
- Usage
- Testing
- What is Auth0?
- Create a free Auth0 Account
- Issue Reporting
- Author
- License
go get github.com/auth0/go-auth0
Reference documentation can be found at pkg.go.dev. For more information about Auth0 please visit the Auth0 Docs page and the Auth0 Management API Docs.
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
}
With the management client we can now 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
}
fmt.Printf("Created client %s\n", c.ClientID)
The following Auth0 resources are supported:
- Actions
- Branding
- Clients (Applications)
- Client Grants
- Connections
- Custom Domains
- Device Credentials
- Grants
- Hooks
- Hook Secrets
- Log Streams
- Logs
- Organizations
- Prompts
- Resource Servers (APIs)
- Roles
- Rules
- Rules Configs
- User Blocks
- Users
- Users By Email
- Blacklists
- Email Templates
- Emails
- Guardian
- Jobs
- Stats
- Tenants
- Anomaly
- Tickets
- Signing Keys
The tests must run against an Auth0 tenant. They also need an M2M app in that tenant that has been authorized to call the Management API. You can easily set one of these up by creating an API Explorer Application in your tenant.
Then simply create a local .env
file in the management
folder with the following settings:
AUTH0_DOMAIN
: The Domain of the M2M appAUTH0_CLIENT_ID
: The Client ID of the M2M appAUTH0_CLIENT_SECRET
: The Client Secret of the M2M appAUTH0_DEBUG
: Set totrue
to call the Management API in debug mode, which dumps the HTTP requests and responses to the output
Auth0 helps you to:
- Add authentication with multiple authentication sources, either social like Google, Facebook, Microsoft Account, LinkedIn, GitHub, Twitter, Box, Salesforce, amont others, or enterprise identity systems like Windows Azure AD, Google Apps, Active Directory, ADFS or any SAML Identity Provider.
- Add authentication through more traditional username/password databases.
- Add support for linking different user accounts with the same user.
- Support for generating signed Json Web Tokens to call your APIs and flow the user identity securely.
- Analytics of how, when and where users are logging in.
- Pull data from other sources and add it to the user profile, through JavaScript rules.
- Go to Auth0 and click "Try Auth0 for Free".
- Use Google, GitHub or Microsoft Account to login.
If you have found a bug or if you have a feature request, please report them at this repository issues section. Please do not report security vulnerabilities on the public GitHub issue tracker. The Responsible Disclosure Program details the procedure for disclosing security issues.
This project is licensed under the MIT license. See the LICENSE file for more info.