Skip to content

go-authgate/sdk-go

Repository files navigation

AuthGate SDK for Go

Lint and Testing CodeQL Trivy Security Scan codecov Go Reference

Go SDK for AuthGate. Requires Go 1.25+.

Installation

go get github.com/go-authgate/sdk-go

Packages

Package Description
credstore Secure credential storage with OS keyring integration and file-based fallback
oauth OAuth 2.0 token client (Device Code, Auth Code, Client Credentials, Refresh, Revoke, Introspect, UserInfo)
discovery OIDC auto-discovery from /.well-known/openid-configuration with caching
authflow CLI flow orchestration (Device Code polling, Auth Code + PKCE, auto-refresh TokenSource with persistent storage)
middleware net/http Bearer token validation middleware with BearerAuth and RequireScope (any Go HTTP framework)
clientcreds Thread-safe Client Credentials token source with auto-cache, HTTPClient() and RoundTripper() for M2M

Package dependency graph

credstore (storage)     discovery (OIDC endpoint URLs)
    |    \                  |
    |     \                 v
    |      +----> oauth <---+
    |              / | \
    |             /  |  \
    v            v   v   v
    +------> authflow  middleware  clientcreds

Development

# Run tests
make test

# Run linter
make lint

# Format code
make fmt

License

See the LICENSE file for details.