Documentation
¶
Overview ¶
Package wwwauth builds RFC 6750 (OAuth 2.0 Bearer Token) WWW-Authenticate response headers. It is a small, dependency-free package so that both the api and auth packages can share a single RFC 6750 implementation without creating an import cycle (auth must not import api).
Index ¶
Constants ¶
const ( // ErrInvalidRequest indicates the request is malformed or missing parameters. ErrInvalidRequest = "invalid_request" // ErrInvalidToken indicates the token is expired, revoked, or malformed. ErrInvalidToken = "invalid_token" // ErrInsufficientScope indicates the request requires higher privileges. ErrInsufficientScope = "insufficient_scope" )
RFC 6750 section 3.1 error codes.
const Realm = "tmi"
Realm identifies the protection space for Bearer token authentication. This is a static value for TMI's API - all protected endpoints share the same realm.
Variables ¶
This section is empty.
Functions ¶
func BuildHeader ¶
BuildHeader builds the value for a RFC 6750 compliant WWW-Authenticate header. Per RFC 6750 section 3, the value always includes the realm and optionally an error and error_description. This is the single source of truth for the header format so a compliance change lands in one place.
Parameters:
- errType: Error code (invalid_request, invalid_token, insufficient_scope) or empty for a basic challenge
- description: Human-readable error description (optional, ignored if errType is empty)
SEM@212287c6c02d99be7f8071b21a50666223646bec: build a RFC 6750 Bearer WWW-Authenticate header value (pure)
Types ¶
This section is empty.