Skip to main content
theauth-go ships 12 dedicated OAuth/OIDC providers, a table-driven catalog of 16 more (below) and OIDC presets for enterprise identity providers. Each dedicated provider is a separate subpackage under provider/, so a consumer only pulls in the HTTP surface for the providers it actually wires.

Install a provider

All provider packages are included in the main module. No separate install is needed.

Wire a provider

Available providers

Catalog providers

These need no package of their own. Build one by name with generic.NewByName:

OIDC presets

provider/oidc has ready configs for Entra, Okta, Keycloak, Authentik, Auth0 and Cognito. Cognito takes the region and user pool id: oidc.Cognito("us-east-1", "us-east-1_AbCdEfGhI", clientID, secret). Each dedicated provider exposes a Config struct and a New(Config) theauth.Provider constructor. Each also ships its own runnable example under examples/oauth-<provider>/ (see Example Apps).

Multiple providers at once

See examples/oauth-multi-provider/ for a full runnable example.

Endpoints

When providers are configured, a.Mount(r) adds:
Where {name} is any registered provider’s Name(), e.g. github, google, microsoft, discord, apple, facebook, slack, gitlab, bitbucket, twitch, linkedin, or x.

Enterprise OIDC presets

provider/oidc ships ready-made configs for common identity providers. Each returns a Config you can adjust before passing to oidc.New.
Multi-tenant Entra. The common and organizations issuers contain a {tenantid} placeholder, so the library rebuilds the expected issuer from the token’s tid claim and checks it. common admits every Entra tenant, so set AllowedTenants when you only want specific ones. Only v2.0 tokens are supported. v1 sts.windows.net issuers are rejected. Email trust. The Entra preset reads email and treats the optional xms_edov claim as the verification signal, so an unverified Entra email is not used to link accounts. Entra often omits email unless you add it as an optional claim. Extra audiences. AdditionalAudiences accepts further aud values besides the client id. The azp check is unchanged. Errors. Failures are *oidc.Error with Provider, Stage (discovery, exchange, verify, userinfo or refresh), Status and the wrapped error. Messages carry no response bodies, secrets or request URLs, so they are safe to log.

Provider tokens

Provider access tokens are encrypted with AES-256-GCM before storage. The Config.EncryptionKey (32-byte) is required if you want provider token storage. Without it, the OAuth state is stored as-is and provider tokens are not persisted. To read a user’s token and have it refreshed when it expires, use GetProviderToken, described in Account lifecycle.

Custom provider

Implement the theauth.Provider interface:
Pass your implementation to Config.Providers alongside the built-in providers.
Last modified on October 13, 2026