authentricity/internal/webui/pg_token.go
2022-07-11 21:49:26 +00:00

23 lines
367 B
Go

package webui
import (
"encoding/json"
"net/http"
)
func (s *Service) debugTokenGet(w http.ResponseWriter, r *http.Request) {
if !requireLogin(w, r) {
return
}
tok := getUserToken(r.Context())
buf, err := json.MarshalIndent(tok, "", " ")
if err != nil {
s.renderError(w)
return
}
w.Header().Set("Content-Type", "application/json")
w.Write(buf)
}