code: func (h ApiAAAHandler) handleLogin(w http.ResponseWriter, r *http.Request, p httprouter.Params) {
  	ctx := r.Context()
  	defer statsd.NewStatsDTiming(ctx).Send("api-aaa.login")
  
  	var loginParams struct {
  		Username string
  		Password string
  	}
  
  	err := json.NewDecoder(r.Body).Decode(&loginParams)
  
  	if err != nil {
  		msg := fmt.Sprintf("Error while decoding payload: %s", err)
  		log.LoggerWContext(ctx).Error(msg)
  		http.Error(w, fmt.Sprint(err), http.StatusBadRequest)
  		return
  	}
  
  	auth, token, err := h.authentication.Login(ctx, loginParams.Username, loginParams.Password)
  
  	if auth {
  		w.WriteHeader(http.StatusOK)
  		res, _ := json.Marshal(map[string]string{
  			"token": token,
  		})
  		fmt.Fprintf(w, string(res))
  	} else {
  		w.WriteHeader(http.StatusUnauthorized)
  		res, _ := json.Marshal(map[string]string{
  			"message": err.Error(),
  		})
  		fmt.Fprintf(w, string(res))
  	}
  }
docs: // Handle an API login