Overview
The Events service provides real-time streaming of authorization events via Server-Sent Events (SSE). Consume events with a channel-based Stream() method or use the Subscribe() convenience wrapper with a callback.
Stream
Open an SSE connection and receive authorization events on a channel. The connection remains open until the context is cancelled.
Parameters (StreamOptions)
Event (GrantexEvent)
Subscribe
Subscribe to events with a callback function. Returns a cancel function to close the connection. This is a convenience wrapper around Stream().
Parameters
Returns
Returns a func() cancel function and an error. Call the cancel function to close the SSE connection.
Event types
grant.created
Emitted when a new grant is created after user consent.
grant.revoked
Emitted when a grant is revoked.
token.issued
Emitted when a grant token is issued (via exchange or refresh).
budget.threshold
Emitted when a grant’s budget consumption crosses 50% or 80%.
budget.exhausted
Emitted when a grant’s budget is fully consumed.
Last modified on March 8, 2026