Twilio无法验证来自Webhooks的请求

时间:2019-07-17 18:26:31

标签: twilio

我无法验证Twilio帖子或无法获得请求。请在下面找到我的代码段,并帮助我进行相应的纠正。

public ResponseEntity<String> businessHolidays(HttpServletRequest request,@RequestParam Map<String, String> requestparams) {
           Map<String,String> tempParams = new HashMap<>();
    return getStringResponseEntity(request,tempParams);
}

private ResponseEntity<String> getStringResponseEntity(HttpServletRequest request, @RequestParam Map<String, String> requestparams) {
    ValidateSignature(request, requestparams);
    return new ResponseEntity<>("Succesful response", HttpStatus.OK);
}

public static void ValidateSignature(HttpServletRequest request, Map<String, String> ivrReuestParams) {
    RequestValidator requestValidator = new RequestValidator("my authtoken");
    System.out.println(request.getRequestURL().toString().replace("http", "https"));
    System.out.println(requestValidator.validate(request.getRequestURL().toString().replace("http", "https"), ivrReuestParams, request.getHeader("X-Twilio-Signature")));    
}

它总是在验证时返回我false。如果您还有其他疑问,请告诉我。

0 个答案:

没有答案