code: func (srv *server) authReq(req, ID []byte, provider auth.Provider, target string) ([]byte, error) {
  	url := srv.getURL("auth" + target)
  
  	token, err := provider.Token(req)
  	if err != nil {
  		return nil, errors.Wrap(errors.APIClientError, errors.AuthenticationFailure, err)
  	}
  
  	aReq := &auth.AuthenticatedRequest{
  		Timestamp:     time.Now().Unix(),
  		RemoteAddress: ID,
  		Token:         token,
  		Request:       req,
  	}
  
  	jsonData, err := json.Marshal(aReq)
  	if err != nil {
  		return nil, errors.Wrap(errors.APIClientError, errors.JSONError, err)
  	}
  
  	response, err := srv.post(url, jsonData)
  	if err != nil {
  		return nil, err
  	}
  
  	result, ok := response.Result.(map[string]interface{})
  	if !ok {
  		return nil, errors.New(errors.APIClientError, errors.JSONError)
  	}
  
  	cert, ok := result["certificate"].(string)
  	if !ok {
  		return nil, errors.New(errors.APIClientError, errors.JSONError)
  	}
  
  	return []byte(cert), nil
  }
docs: // authReq is the common logic for AuthSign and AuthInfo -- perform the given
  // request, and return the resultant certificate.
  // The target is either 'sign' or 'info'.