Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
O

oauth2

> 安全
Open source

OAuth 2.0 server library for the Go programming language.

3.6K stars0 likes0 views
WebsiteGitHub

About

OAuth 2.0 server library for the Go programming language.

Golang OAuth 2.0 Server

An open protocol to allow secure authorization in a simple and standard method from web, mobile and desktop applications.

Build Codecov ReportCard GoDoc License

Protocol Flow

…

Quick Start

Download and install

bash
go get -u -v github.com/go-oauth2/oauth2/v4/...

Create file server.go

…

Build and run

bash
go build server.go

./server

Open in your web browser

Authorization Request: http://localhost:9096/authorize?client_id=000000&response_type=code

Grant Token Request: http://localhost:9096/token?grant_type=client_credentials&client_id=000000&client_secret=999999&scope=read

json
{
  "access_token": "J86XVRYSNFCFI233KXDL0Q",
  "expires_in": 7200,
  "scope": "read",
  "token_type": "Bearer"
}

Features

  • Easy to use
  • Based on the RFC 6749 implementation
  • Token storage support TTL
  • Support custom expiration time of the access token
  • Support custom extension field
  • Support custom scope
  • Support jwt to generate access tokens

Example

A complete example of simulation authorization code model

Simulation examples of authorization code model, please check example

Use jwt to generate access tokens

…

Store Implements

  • BuntDB(default store)
  • Redis
  • MongoDB
  • MySQL
  • MySQL (Provides both client and token store)
  • PostgreSQL
  • DynamoDB
  • XORM
  • XORM (MySQL, client and token store)
  • GORM
  • Firestore
  • Hazelcast (token only)

Handy Utilities

  • OAuth2 Proxy Logger (Debug utility that proxies interfaces and logs)

MIT License

Copyright (c) 2016 Lyric

Issues· 113 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Gogo-oauth2go-oauth2-serveroauth2oauth2-authentication

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category安全
PricingOpen source

> Related tools

O
OWASP ZAP
开源 Web 应用安全扫描器
O
owasp-wstg-tracker
Simple web app to track OWASP WSTG security testing progress
H
homebridge-mi-gateway-security
XiaoMi Gateway Security plugin for HomeBridge.