go-oauth2/oauth2 is an OAuth 2.0 server library for the Go programming language.
The library addresses the need to implement OAuth 2.0 authorization servers in Go applications. It provides a standards-based implementation following RFC 6749, handling the core OAuth 2.0 flows including authorization code and client credentials grant types. The tool manages token generation, validation, and storage, with support for custom access token expiration times, extension fields, and scopes. It can generate access tokens using JWT format when needed.
The library suits projects requiring OAuth 2.0 provider functionality rather than client-side OAuth consumption. It works well for applications that need to issue tokens to third-party clients or manage authorization across web, mobile, and desktop applications. The tool comes with BuntDB as a default token and client store but supports pluggable storage backends, allowing integration with Redis, MongoDB, MySQL, PostgreSQL, DynamoDB, GORM, Firestore, and other databases depending on which community-maintained store implementation a developer chooses.
The project maintains a straightforward codebase with focused development activity. The repository includes working examples demonstrating the authorization code flow and JWT token generation patterns. Documentation is provided through the official Go package reference alongside the README's quick-start guide and protocol flow diagrams.