This is a Go library for obtaining, refreshing, and attaching OAuth 2.0 access tokens to HTTP requests. It provides a generic token source interface with interchangeable implementations for different OAuth 2.0 grant types, and wraps the Go net/http transport layer to automatically attach access tokens as Authorization headers on outgoing requests.
The library supports the authorization code flow, generating consent page URLs and exchanging authorization codes for tokens. It also implements the device authorization grant for authentication on devices without a browser, and the resource owner password credentials grant for trusted client scenarios. For long-lived credentials, it offers a static token source that always returns the same token.
Token lifecycle management covers acquisition, caching, and automatic refresh using stored refresh tokens. The library caches tokens until they expire, then transparently fetches fresh ones without interrupting the caller. It also provides an authenticated HTTP client that wraps any HTTP client with automatic token injection and refresh.