Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Category ¶
type Category int
Category is a coarse, UX-oriented classification of an OAuth error, used to decide how to handle it (which problem page to show, whether a retry helps).
const ( // CategoryFailed is the default: an unexpected failure or one that indicates // application misconfiguration. Retrying is not expected to help. CategoryFailed Category = iota // CategoryCancelled is a user-initiated, recoverable outcome (declined consent // or pressed cancel/back). The user can simply try again. CategoryCancelled // CategoryAccessDenied is an authorization denial: the user authenticated but // is not permitted (tenant/role/admin policy). Retrying re-denies. CategoryAccessDenied // succeed. CategoryUnavailable )
type Error ¶
type Error struct {
// Code is the OAuth 2.0 `error` parameter, e.g. "access_denied".
Code string
// Subcode is a provider extension (Microsoft `error_subcode`, e.g. "cancel").
Subcode string
// Description is the human-readable `error_description` parameter.
Description string
// Uri is the `error_uri` parameter.
Uri string
}
Error represents an OAuth 2.0 authorization error response (RFC 6749 §4.1.2.1), which the provider returns via the redirect URI instead of an authorization code, e.g. when the user declines consent or cancels (error=access_denied).
func (*Error) Category ¶
Category classifies the error for UX handling. The mapping is intentionally conservative: a bare access_denied is treated as a cancellation (the common, non-alarming case), and only escalated to a denial when an explicit policy signal is present. Unrecognized errors fall through to CategoryFailed so they are never silently treated as recoverable.