MCPcopy Create free account
hub / github.com/supabase/auth / Verify

Method Verify

internal/api/verify.go:95–118  ·  view source on GitHub ↗

Verify exchanges a confirmation or recovery token to a refresh token

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

Source from the content-addressed store, hash-verified

93
94// Verify exchanges a confirmation or recovery token to a refresh token
95func (a *API) Verify(w http.ResponseWriter, r *http.Request) error {
96 params := &VerifyParams{}
97 switch r.Method {
98 case http.MethodGet:
99 params.Token = r.FormValue("token")
100 params.Type = r.FormValue("type")
101 params.RedirectTo = utilities.GetReferrer(r, a.config)
102 if err := params.Validate(r, a); err != nil {
103 return err
104 }
105 return a.verifyGet(w, r, params)
106 case http.MethodPost:
107 if err := retrieveRequestParams(r, params); err != nil {
108 return err
109 }
110 if err := params.Validate(r, a); err != nil {
111 return err
112 }
113 return a.verifyPost(w, r, params)
114 default:
115 // this should have been handled by Chi
116 panic("Only GET and POST methods allowed")
117 }
118}
119
120func (a *API) verifyGet(w http.ResponseWriter, r *http.Request, params *VerifyParams) error {
121 ctx := r.Context()

Callers

nothing calls this directly

Calls 5

ValidateMethod · 0.95
verifyGetMethod · 0.95
verifyPostMethod · 0.95
GetReferrerFunction · 0.92
retrieveRequestParamsFunction · 0.85

Tested by

no test coverage detected