OAuth2 returns the state from an oauth request.
(r *http.Request)
| 29 | |
| 30 | // OAuth2 returns the state from an oauth request. |
| 31 | func OAuth2(r *http.Request) OAuth2State { |
| 32 | oauth, ok := r.Context().Value(oauth2StateKey{}).(OAuth2State) |
| 33 | if !ok { |
| 34 | panic("developer error: oauth middleware not provided") |
| 35 | } |
| 36 | return oauth |
| 37 | } |
| 38 | |
| 39 | // ExtractOAuth2 is a middleware for automatically redirecting to OAuth |
| 40 | // URLs, and handling the exchange inbound. Any route that does not have |