Token is the endpoint for OAuth access token requests
(w http.ResponseWriter, r *http.Request)
| 33 | |
| 34 | // Token is the endpoint for OAuth access token requests |
| 35 | func (a *API) Token(w http.ResponseWriter, r *http.Request) error { |
| 36 | ctx := r.Context() |
| 37 | grantType := r.FormValue("grant_type") |
| 38 | |
| 39 | switch grantType { |
| 40 | case "password": |
| 41 | return a.ResourceOwnerPasswordGrant(ctx, w, r) |
| 42 | case "refresh_token": |
| 43 | return a.RefreshTokenGrant(ctx, w, r) |
| 44 | default: |
| 45 | return oauthError("unsupported_grant_type", "") |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | // ResourceOwnerPasswordGrant implements the password grant type flow |
| 50 | func (a *API) ResourceOwnerPasswordGrant(ctx context.Context, w http.ResponseWriter, r *http.Request) error { |
nothing calls this directly
no test coverage detected