awesome-repositories.com
Blog
MCP
awesome-repositories.com

Discover the best open-source repositories with AI-powered search.

ExploreCurated searchesOpen-source alternativesSelf-hosted softwareBlogSitemap
ProjectMCP serverAboutHow we rankPress
LegalPrivacyTerms
© 2026 Bringes Technology SRL·VAT RO45896025·hello@awesome-repositories.com
golang avatar

golang/oauth2

0
View on GitHub↗
5,872 stars·1,046 forks·Go·BSD-3-Clause·16 viewsgolang.org/x/oauth2↗

Oauth2

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.

Features

  • OAuth 2.0 Authorization Flows - A Go library for obtaining, refreshing, and attaching OAuth 2.0 access tokens to HTTP requests.
  • Go Client Libraries - Provides a Go library for obtaining, refreshing, and attaching OAuth 2.0 access tokens to HTTP requests.
  • Authenticated Transports - Attaches access tokens to outgoing HTTP requests by wrapping the transport layer for authenticated communication.
  • Authenticated Request Clients - Wraps an HTTP client with automatic token injection and refresh for every outgoing request.
  • OAuth Token Refreshes - Provides a token source interface with implementations for refresh, caching, and static credentials.
  • Automatic Token Refreshes - Transparently obtains new access tokens using stored refresh tokens when current ones expire.
  • Authorization Code Exchanges - Generates consent page URLs and exchanges authorization codes for access tokens.
  • Automatic Request Token Injection - Adds access tokens as Authorization headers on outgoing HTTP requests made with the Go net/http client.
  • Transport-Level Token Injectors - Wraps the Go net/http transport layer to automatically attach OAuth 2.0 access tokens as Authorization headers.
  • Authorization Code Exchanges - Exchanges authorization codes for access tokens after redirecting users to consent pages.
  • Authorization Code Flow Handlers - Generates consent page URLs and exchanges authorization codes for access tokens.
  • Authorization Code Flow Initiators - Initiates the three-legged OAuth 2.0 authorization code flow with consent URL generation and code exchange.
  • Token Acquisitions - Exchanges authorization codes and credentials for short-lived access tokens and optional refresh tokens.
  • OAuth2 Token Source Suppliers - Provides a generic token source interface with interchangeable implementations for different OAuth 2.0 grant types.
  • Device Authorization Flow Clients - Initiates the OAuth 2.0 device authorization flow by polling for user approval and retrieving tokens.
  • Device Grant Implementations - Implements the OAuth 2.0 Device Authorization Grant for headless devices with polling for user approval.
  • Device Authorization Flow Initiators - Starts the OAuth 2.0 device authorization flow by obtaining a device code and polling for user approval.
  • Device Authorization Polling Clients - Implements the OAuth 2.0 device authorization grant with polling for user approval on browserless devices.
  • Resource Owner Password Credentials Grant Handlers - Exchanges a username and password directly for an access token using the OAuth 2.0 password grant type.
  • Resource Owner Password Grant Handlers - Exchanges a username and password directly for an OAuth 2.0 access token in trusted client scenarios.
  • Authentication Token Caching - Caches authentication tokens across sessions, returning cached tokens until they expire then fetching fresh ones automatically.
  • Cached Token Reuses - Returns cached tokens until they expire, then transparently fetches fresh ones to minimize redundant authorization requests.
  • Static Token Sources - Offers a static token source for long-lived credentials that never expire.
  • Authorization URL Generators - Produces authorization URLs with PKCE challenge and access type parameters for OAuth 2.0 flows.
  • Consent URL Builders - Builds consent page URLs with requested scopes and optional PKCE protection for OAuth 2.0 flows.
  • DevOps & Infrastructure - Standard library for implementing OAuth2 authentication flows.
  • Authentication and Authorization - General OAuth 2.0 client implementation.
  • Security & Privacy - Generic OAuth 2.0 package with support for major providers.

Star history

Star history chart for golang/oauth2Star history chart for golang/oauth2

How this analysis was created: This summary and feature list are AI-generated from collected project material and can contain mistakes. Stars, license and language are imported from GitHub. Inclusion does not mean that we have tested or audited this project. Check the source documentation for any feature you depend on. Learn more on our About page.

AI search

Explore more awesome repositories

Describe what you need in plain English — the AI ranks thousands of curated open-source projects by relevance.

Start searching with AI

Projects sharing features with Oauth2

These projects share indexed features with Oauth2. Shared tags can include platform or build tooling; verify the primary use case before treating a result as a replacement.
  • praw-dev/prawpraw-dev avatar

    praw-dev/praw

    4,168View on GitHub↗

    PRAW is a Python wrapper for the Reddit API, functioning as a REST API client and social media data crawler. It provides a programmatic interface to fetch data, manage account content, and interact with the platform. The library implements a comprehensive OAuth 2.0 client supporting multiple authorization flows, including password, implicit, and refresh tokens, as well as read-only guest access. It distinguishes itself through a rate-limit-aware request scheduler that tracks server-side throttling to prevent API quota exhaustion and employs lazy-loading resource objects to fetch data only whe

    Pythonapioauthpraw
    View on GitHub↗4,168
  • spotipy-dev/spotipyspotipy-dev avatar

    spotipy-dev/spotipy

    5,450View on GitHub↗

    Spotipy is a Python client library for interacting with the Spotify Web API. It provides a programmatic interface to manage music data, user accounts, and media playback. The library implements a full OAuth 2.0 client capable of handling authorization codes, client credentials, and implicit grants. It includes a token manager that supports automated token refreshing and pluggable caching backends to maintain stateful sessions. The project covers music metadata retrieval and search, allowing for the lookup of artists, albums, and tracks via resource identifiers and URIs. It also provides capa

    Python
    View on GitHub↗5,450
  • thephpleague/oauth2-serverthephpleague avatar

    thephpleague/oauth2-server

    6,650View on GitHub↗

    This project is a PHP library for implementing a spec-compliant OAuth 2.0 authorization server. It serves as an authentication framework for managing user identities and client authorizations, providing the necessary components to issue and validate access and refresh tokens. The server supports a wide range of standardized authorization flows, including authorization code exchange, device grants, implicit flows, and PKCE enforcement. It handles complex token lifecycles through refresh token rotation, scope management, and the use of asymmetric keys for signing digital tokens. The system pro

    PHPoauthoauth2oauth2-server
    View on GitHub↗6,650
  • lepture/authliblepture avatar

    lepture/authlib

    5,346View on GitHub↗

    Authlib is a comprehensive Python framework for implementing OAuth 1.0, OAuth 2.0, and OpenID Connect clients and servers. It provides a complete toolkit for identity management, spanning the development of authorization servers, resource servers, and client-side integrations. The library distinguishes itself through a full implementation of the JOSE specifications, including JSON Web Tokens, Encryption, Signatures, and Keys. It features specialized capabilities for non-interactive authentication via service account assertion frameworks and a compliance-correction layer designed to handle ide

    Python
    View on GitHub↗5,346
Compare all 30 related projects→

Frequently asked questions

What does golang/oauth2 do?

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.

What are the main features of golang/oauth2?

The main features of golang/oauth2 are: OAuth 2.0 Authorization Flows, Go Client Libraries, Authenticated Transports, Authenticated Request Clients, OAuth Token Refreshes, Automatic Token Refreshes, Authorization Code Exchanges, Automatic Request Token Injection.

Which projects share features with golang/oauth2?

Projects with overlapping indexed features include: spotipy-dev/spotipy — Spotipy is a Python client library for interacting with the Spotify Web API. It provides a programmatic interface to… praw-dev/praw — PRAW is a Python wrapper for the Reddit API, functioning as a REST API client and social media data crawler. It… thephpleague/oauth2-server — This project is a PHP library for implementing a spec-compliant OAuth 2.0 authorization server. It serves as an… lepture/authlib — Authlib is a comprehensive Python framework for implementing OAuth 1.0, OAuth 2.0, and OpenID Connect clients and… wechatpy/wechatpy — wechatpy is a Python API SDK designed for interacting with official accounts, mini programs, and corporate… thephpleague/oauth2-client — This library is a PHP toolkit for managing OAuth 2.0 authentication flows and connecting applications to external…