Usage examples for the AuthGate Go SDK.
Set environment variables before running:
export AUTHGATE_URL=https://auth.example.com
export CLIENT_ID=your-client-id
export CLIENT_SECRET=your-client-secret # only for M2MAuto-detects browser availability: uses Auth Code + PKCE on local machines, falls back to Device Code in SSH sessions. Tokens are cached in OS keyring.
cd cli
go run main.goProtects HTTP endpoints with Bearer token middleware. Works with any Go HTTP framework.
cd webservice
go run main.go
# Test
curl -H "Authorization: Bearer <token>" http://localhost:8080/api/profile
curl -H "Authorization: Bearer <token>" http://localhost:8080/api/dataUses Client Credentials grant with auto-caching. No user interaction needed.
cd m2m
go run main.go