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

Method extractBearerToken

internal/api/auth.go:67–75  ·  view source on GitHub ↗
(r *http.Request)

Source from the content-addressed store, hash-verified

65}
66
67func (a *API) extractBearerToken(r *http.Request) (string, error) {
68 authHeader := r.Header.Get("Authorization")
69 matches := bearerRegexp.FindStringSubmatch(authHeader)
70 if len(matches) != 2 {
71 return "", apierrors.NewHTTPError(http.StatusUnauthorized, apierrors.ErrorCodeNoAuthorization, "This endpoint requires a valid Bearer token")
72 }
73
74 return matches[1], nil
75}
76
77func (a *API) parseJWTClaims(bearer string, r *http.Request) (context.Context, error) {
78 ctx := r.Context()

Calls 2

NewHTTPErrorFunction · 0.92
GetMethod · 0.45

Tested by 2