package server

import (
	"net/http"
)

func (s *Server) verify(w http.ResponseWriter, r *http.Request) {
	if r.Method != "POST" {
		http.NotFound(w, r)
		return
	}
	access := r.FormValue("access")
	token, ok := s.getToken(access)
	if !ok {
		http.Error(w, "unknown access", http.StatusUnauthorized)
		return
	}
	w.Write([]byte(token))
}
