package api import ( "encoding/json" "github.com/go-chi/jwtauth/v5" "log" "net/http" ) func Debug(w http.ResponseWriter, r *http.Request) { _, claims, err := jwtauth.FromContext(r.Context()) if err != nil { log.Printf("Error reading token: %v", err) w.WriteHeader(http.StatusBadRequest) return } data, err := json.Marshal(struct { Claims map[string]any `json:"claims"` }{ claims, }) if err != nil { log.Printf("Error marshalling response: %v", err) w.WriteHeader(http.StatusBadRequest) return } w.Header().Set("Content-Type", "application/json") _, _ = w.Write(data) }