22
33> Using Gin framework implementation OAuth 2.0 services
44
5- [ ![ License] [ License-Image ]] [ License-Url ] [ ![ ReportCard] [ ReportCard-Image ]] [ ReportCard-Url ] [ ![ GoDoc] [ GoDoc-Image ]] [ GoDoc-Url ]
5+ [ ![ License] [ license-image ]] [ license-url ] [ ![ ReportCard] [ reportcard-image ]] [ reportcard-url ] [ ![ GoDoc] [ godoc-image ]] [ godoc-url ]
66
77## Quick Start
88
99### Download and install
1010
11- ``` bash
11+ ``` bash
1212$ go get -u github.com/go-oauth2/gin-server
1313```
1414
1515### Create file ` server.go `
1616
17- ``` go
17+ ``` go
1818package main
1919
2020import (
2121 " net/http"
2222
2323 " github.com/gin-gonic/gin"
2424 " github.com/go-oauth2/gin-server"
25- " gopkg.in/ oauth2.v3 /manage"
26- " gopkg.in/ oauth2.v3 /models"
27- " gopkg.in/ oauth2.v3 /server"
28- " gopkg.in/ oauth2.v3 /store"
25+ " github.com/go- oauth2/oauth2/v4 /manage"
26+ " github.com/go- oauth2/oauth2/v4 /models"
27+ " github.com/go- oauth2/oauth2/v4 /server"
28+ " github.com/go- oauth2/oauth2/v4 /store"
2929)
3030
3131func main () {
@@ -74,7 +74,7 @@ func main() {
7474
7575### Build and run
7676
77- ``` bash
77+ ``` bash
7878$ go build server.go
7979$ ./server
8080```
@@ -87,12 +87,12 @@ $ ./server
8787http://localhost:9096/oauth2/token?grant_type=client_credentials&client_id=000000&client_secret=999999&scope=read
8888```
8989
90- ``` json
90+ ``` json
9191{
92- "access_token" : " AJPNSQO2PCITABYX0RFLWG" ,
93- "expires_in" : 7200 ,
94- "scope" : " read" ,
95- "token_type" : " Bearer"
92+ "access_token" : " AJPNSQO2PCITABYX0RFLWG" ,
93+ "expires_in" : 7200 ,
94+ "scope" : " read" ,
95+ "token_type" : " Bearer"
9696}
9797```
9898
@@ -102,21 +102,21 @@ http://localhost:9096/oauth2/token?grant_type=client_credentials&client_id=00000
102102http://localhost:9096/api/test?access_token=AJPNSQO2PCITABYX0RFLWG
103103```
104104
105- ``` json
105+ ``` json
106106{
107- "ClientID" : " 000000" ,
108- "UserID" : " " ,
109- "RedirectURI" : " " ,
110- "Scope" : " read" ,
111- "Code" : " " ,
112- "CodeCreateAt" : " 0001-01-01T00:00:00Z" ,
113- "CodeExpiresIn" : 0 ,
114- "Access" : " AJPNSQO2PCITABYX0RFLWG" ,
115- "AccessCreateAt" : " 2016-11-29T09:00:52.617250916+08:00" ,
116- "AccessExpiresIn" : 7200000000000 ,
117- "Refresh" : " " ,
118- "RefreshCreateAt" : " 0001-01-01T00:00:00Z" ,
119- "RefreshExpiresIn" : 0
107+ "ClientID" : " 000000" ,
108+ "UserID" : " " ,
109+ "RedirectURI" : " " ,
110+ "Scope" : " read" ,
111+ "Code" : " " ,
112+ "CodeCreateAt" : " 0001-01-01T00:00:00Z" ,
113+ "CodeExpiresIn" : 0 ,
114+ "Access" : " AJPNSQO2PCITABYX0RFLWG" ,
115+ "AccessCreateAt" : " 2016-11-29T09:00:52.617250916+08:00" ,
116+ "AccessExpiresIn" : 7200000000000 ,
117+ "Refresh" : " " ,
118+ "RefreshCreateAt" : " 0001-01-01T00:00:00Z" ,
119+ "RefreshExpiresIn" : 0
120120}
121121```
122122
@@ -126,9 +126,9 @@ http://localhost:9096/api/test?access_token=AJPNSQO2PCITABYX0RFLWG
126126Copyright (c) 2016 Lyric
127127```
128128
129- [ License-Url ] : http://opensource.org/licenses/MIT
130- [ License-Image ] : https://img.shields.io/npm/l/express.svg
131- [ ReportCard-Url ] : https://goreportcard.com/report/github.com/go-oauth2/gin-server
132- [ ReportCard-Image ] : https://goreportcard.com/badge/github.com/go-oauth2/gin-server
133- [ GoDoc-Url ] : https://godoc.org/github.com/go-oauth2/gin-server
134- [ GoDoc-Image ] : https://godoc.org/github.com/go-oauth2/gin-server?status.svg
129+ [ license-url ] : http://opensource.org/licenses/MIT
130+ [ license-image ] : https://img.shields.io/npm/l/express.svg
131+ [ reportcard-url ] : https://goreportcard.com/report/github.com/go-oauth2/gin-server
132+ [ reportcard-image ] : https://goreportcard.com/badge/github.com/go-oauth2/gin-server
133+ [ godoc-url ] : https://godoc.org/github.com/go-oauth2/gin-server
134+ [ godoc-image ] : https://godoc.org/github.com/go-oauth2/gin-server?status.svg
0 commit comments