首页 > 解决方案 > Twilio 验证 API 验证调用返回 curl 错误

问题描述

我现在正在尝试 Twilio 验证 API,指南实际上显示只有两次调用 API 以将 OTP 发送到目标电话号码并检查最终用户输入的 OTP 是否正确。我的验证代码部分有问题,它返回 curl 错误。

OTP 已成功发送到目标手机。

这是我用来检查 OTP 的 curl 命令:

curl -GET 'https://api.authy.com/protected/json/phones/verification/check' -d api_key=xxxx -d verification_code=xxxx-d phone_number=xx-d country_code=xx

这是错误消息:

curl: (58) could not load PEM client certificate, OpenSSL error error:02001002:system library:fopen:No such file or directory, (no key found, wrong pass phrase, or wrong file format?)

标签: twilio-api

解决方案


抱歉没有正确阅读错误消息,我已经通过将服务器的 SSL 证书路径和私钥路径添加到 curl 命令来修复它并且它可以工作。

curl -GET 'https://api.authy.com/protected/json/phones/verification/check' -d api_key=xxxx -d verification_code=xxxx-d phone_number=xx-d country_code=xx --cert path/to/fullchain.pem --key path/to/privkey.pem

推荐阅读