MCPcopy Create free account
hub / github.com/zitadel/oidc / checkToken

Function checkToken

example/client/api/api.go:96–107  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

94}
95
96func checkToken(w http.ResponseWriter, r *http.Request) (bool, string) {
97 auth := r.Header.Get("authorization")
98 if auth == "" {
99 http.Error(w, "auth header missing", http.StatusUnauthorized)
100 return false, ""
101 }
102 if !strings.HasPrefix(auth, oidc.PrefixBearer) {
103 http.Error(w, "invalid header", http.StatusUnauthorized)
104 return false, ""
105 }
106 return true, strings.TrimPrefix(auth, oidc.PrefixBearer)
107}

Callers 1

mainFunction · 0.85

Calls 1

ErrorMethod · 0.45

Tested by

no test coverage detected