2
2
3
3
> An open protocol to allow secure authorization in a simple and standard method from web, mobile and desktop applications.
4
4
5
- [ ![ Build] [ Build-Status-Image ]] [ Build-Status-Url ] [ ![ Codecov] [ codecov-image ]] [ codecov-url ] [ ![ ReportCard] [ reportcard-image ]] [ reportcard-url ] [ ![ GoDoc] [ godoc-image ]] [ godoc-url ] [ ![ License] [ license-image ]] [ license-url ]
5
+ [ ![ Build] [ build-status-image ]] [ build-status-url ] [ ![ Codecov] [ codecov-image ]] [ codecov-url ] [ ![ ReportCard] [ reportcard-image ]] [ reportcard-url ] [ ![ GoDoc] [ godoc-image ]] [ godoc-url ] [ ![ License] [ license-image ]] [ license-url ]
6
6
7
7
## Protocol Flow
8
8
9
- ``` text
9
+ ``` text
10
10
+--------+ +---------------+
11
11
| |--(A)- Authorization Request ->| Resource |
12
12
| | | Owner |
30
30
31
31
### Download and install
32
32
33
- ``` bash
33
+ ``` bash
34
34
go get -u -v github.com/go-oauth2/oauth2/v4/...
35
35
```
36
36
37
37
### Create file ` server.go `
38
38
39
- ``` go
39
+ ``` go
40
40
package main
41
41
42
42
import (
@@ -95,7 +95,7 @@ func main() {
95
95
96
96
### Build and run
97
97
98
- ``` bash
98
+ ``` bash
99
99
go build server.go
100
100
101
101
./server
@@ -105,24 +105,24 @@ go build server.go
105
105
106
106
[ http://localhost:9096/token?grant_type=client_credentials&client_id=000000&client_secret=999999&scope=read ] ( http://localhost:9096/token?grant_type=client_credentials&client_id=000000&client_secret=999999&scope=read )
107
107
108
- ``` json
108
+ ``` json
109
109
{
110
- "access_token" : " J86XVRYSNFCFI233KXDL0Q" ,
111
- "expires_in" : 7200 ,
112
- "scope" : " read" ,
113
- "token_type" : " Bearer"
110
+ "access_token" : " J86XVRYSNFCFI233KXDL0Q" ,
111
+ "expires_in" : 7200 ,
112
+ "scope" : " read" ,
113
+ "token_type" : " Bearer"
114
114
}
115
115
```
116
116
117
117
## Features
118
118
119
- * Easy to use
120
- * Based on the [ RFC 6749] ( https://tools.ietf.org/html/rfc6749 ) implementation
121
- * Token storage support TTL
122
- * Support custom expiration time of the access token
123
- * Support custom extension field
124
- * Support custom scope
125
- * Support jwt to generate access tokens
119
+ - Easy to use
120
+ - Based on the [ RFC 6749] ( https://tools.ietf.org/html/rfc6749 ) implementation
121
+ - Token storage support TTL
122
+ - Support custom expiration time of the access token
123
+ - Support custom extension field
124
+ - Support custom scope
125
+ - Support jwt to generate access tokens
126
126
127
127
## Example
128
128
@@ -161,28 +161,28 @@ if !ok || !token.Valid {
161
161
162
162
## Store Implements
163
163
164
- * [ BuntDB] ( https://github.com/tidwall/buntdb ) (default store)
165
- * [ Redis] ( https://github.com/go-oauth2/redis )
166
- * [ MongoDB] ( https://github.com/go-oauth2/mongo )
167
- * [ MySQL] ( https://github.com/go-oauth2/mysql )
168
- * [ MySQL (Provides both client and token store)] ( https://github.com/imrenagi/go-oauth2-mysql )
169
- * [ PostgreSQL] ( https://github.com/vgarvardt/go-oauth2-pg )
170
- * [ DynamoDB] ( https://github.com/contamobi/go-oauth2-dynamodb )
171
- * [ XORM] ( https://github.com/techknowlogick/go-oauth2-xorm )
172
- * [ XORM (MySQL, client and token store)] ( https://github.com/rainlay/go-oauth2-xorm )
173
- * [ GORM] ( https://github.com/techknowlogick/go-oauth2-gorm )
174
- * [ Firestore] ( https://github.com/tslamic/go-oauth2-firestore )
164
+ - [ BuntDB] ( https://github.com/tidwall/buntdb ) (default store)
165
+ - [ Redis] ( https://github.com/go-oauth2/redis )
166
+ - [ MongoDB] ( https://github.com/go-oauth2/mongo )
167
+ - [ MySQL] ( https://github.com/go-oauth2/mysql )
168
+ - [ MySQL (Provides both client and token store)] ( https://github.com/imrenagi/go-oauth2-mysql )
169
+ - [ PostgreSQL] ( https://github.com/vgarvardt/go-oauth2-pg )
170
+ - [ DynamoDB] ( https://github.com/contamobi/go-oauth2-dynamodb )
171
+ - [ XORM] ( https://github.com/techknowlogick/go-oauth2-xorm )
172
+ - [ XORM (MySQL, client and token store)] ( https://github.com/rainlay/go-oauth2-xorm )
173
+ - [ GORM] ( https://github.com/techknowlogick/go-oauth2-gorm )
174
+ - [ Firestore] ( https://github.com/tslamic/go-oauth2-firestore )
175
175
176
176
## Handy Utilities
177
177
178
- * [ OAuth2 Proxy Logger (Debug utility that proxies interfaces and logs)] ( https://github.com/aubelsb2/oauth2-logger-proxy )
178
+ - [ OAuth2 Proxy Logger (Debug utility that proxies interfaces and logs)] ( https://github.com/aubelsb2/oauth2-logger-proxy )
179
179
180
180
## MIT License
181
181
182
- Copyright (c) 2016 Lyric
182
+ Copyright (c) 2016 Lyric
183
183
184
- [ Build-Status-Url ] : https://travis-ci.org/go-oauth2/oauth2
185
- [ Build-Status-Image ] : https://travis-ci.org/go-oauth2/oauth2.svg?branch=master
184
+ [ build-status-url ] : https://travis-ci.org/go-oauth2/oauth2
185
+ [ build-status-image ] : https://travis-ci.org/go-oauth2/oauth2.svg?branch=master
186
186
[ codecov-url ] : https://codecov.io/gh/go-oauth2/oauth2
187
187
[ codecov-image ] : https://codecov.io/gh/go-oauth2/oauth2/branch/master/graph/badge.svg
188
188
[ reportcard-url ] : https://goreportcard.com/report/github.com/go-oauth2/oauth2/v4
0 commit comments