MCPcopy Index your code
hub / github.com/supabase/auth / requireAuthentication

Method requireAuthentication

internal/api/auth.go:20–36  ·  view source on GitHub ↗

requireAuthentication checks incoming requests for tokens presented using the Authorization header

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

Source from the content-addressed store, hash-verified

18
19// requireAuthentication checks incoming requests for tokens presented using the Authorization header
20func (a *API) requireAuthentication(w http.ResponseWriter, r *http.Request) (context.Context, error) {
21 token, err := a.extractBearerToken(r)
22 if err != nil {
23 return nil, err
24 }
25
26 ctx, err := a.parseJWTClaims(token, r)
27 if err != nil {
28 return ctx, err
29 }
30
31 ctx, err = a.maybeLoadUserOrSession(ctx)
32 if err != nil {
33 return ctx, err
34 }
35 return ctx, err
36}
37
38func (a *API) requireNotAnonymous(w http.ResponseWriter, r *http.Request) (context.Context, error) {
39 ctx := r.Context()

Callers 1

IdTokenGrantMethod · 0.95

Calls 3

extractBearerTokenMethod · 0.95
parseJWTClaimsMethod · 0.95

Tested by

no test coverage detected