MCPcopy Create free account
hub / github.com/netlify/gotrue / Token

Method Token

api/token.go:35–47  ·  view source on GitHub ↗

Token is the endpoint for OAuth access token requests

(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

33
34// Token is the endpoint for OAuth access token requests
35func (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
50func (a *API) ResourceOwnerPasswordGrant(ctx context.Context, w http.ResponseWriter, r *http.Request) error {

Callers

nothing calls this directly

Calls 3

RefreshTokenGrantMethod · 0.95
oauthErrorFunction · 0.85

Tested by

no test coverage detected