@@ -150,6 +150,11 @@ when GOIC has new features.
150
150
For signing out you need to manually invoke ` g.SignOut() ` from within http context. See the [ API] ( #signout ) below.
151
151
There is also a working [ example] ( ./examples/all.go ) . Note that not all Providers support signing out.
152
152
153
+ ### Revocation
154
+
155
+ To revoke a token manually, invoke ` g.RevokeToken() ` from any context. See the [ API] ( #revoketoken ) below.
156
+ There is also a working [ example] ( ./examples/all.go ) . Note that not all Providers support signing out.
157
+
153
158
---
154
159
## GOIC API
155
160
@@ -167,18 +172,6 @@ g.Supports("abc") // true
167
172
g.Supports (" xyz" ) // false
168
173
```
169
174
170
- #### RefreshToken
171
-
172
- Use it to request Access token by using refresh token.
173
-
174
- ``` go
175
- g := goic.New (" /auth/o8" , false )
176
- // ... add providers
177
- t := &goic.Token {RefreshToken: " your refresh token" , Provider : goic.Microsoft .Name }
178
- tok , err := g.RefreshToken (t)
179
- // Do something with tok.AccessToken
180
- ```
181
-
182
175
#### RequestAuth
183
176
184
177
Manually request authentication from OpenID Provider. Must be called from within http context.
@@ -217,6 +210,18 @@ redir := "https://localhost/auth/o8/" + p.Name
217
210
tok , err := g.Authenticate (p, code, nonce, redir)
218
211
```
219
212
213
+ #### RefreshToken
214
+
215
+ Use it to request Access token by using refresh token.
216
+
217
+ ``` go
218
+ g := goic.New (" /auth/o8" , false )
219
+ // ... add providers
220
+ t := &goic.Token {RefreshToken: " your refresh token" , Provider : goic.Microsoft .Name }
221
+ tok , err := g.RefreshToken (t)
222
+ // Do something with tok.AccessToken
223
+ ```
224
+
220
225
#### Userinfo
221
226
222
227
Manually request Userinfo by using the token returned by Authentication above.
@@ -245,6 +250,18 @@ err := g.SignOut(tok, "http://some/preconfigured/redir/uri", res, req)
245
250
err := g.SignOut (tok, " " , res, req)
246
251
```
247
252
253
+ #### RevokeToken
254
+
255
+ Use it to revoke the token so that is incapacitated.
256
+
257
+ ``` go
258
+ g := goic.New (" /auth/o8" , false )
259
+ p := g.NewProvider (" abc" , " ..." ).WithCredential (" ..." , " ..." )
260
+ // ...
261
+ tok := &goic.Token {AccessToken: " current session token" , Provider : p.Name }
262
+ err := g.RevokeToken (tok)
263
+ ```
264
+
248
265
---
249
266
### Demo
250
267
0 commit comments