"参数无效:authy_id - 需要参数"。如何通过authy_id获取authy_id?

时间:2018-03-29 07:45:00

标签: android twilio twilio-api

我尝试在我的应用中实施twilio短信验证。我按照this指南实施了短信验证。现在我成功获得短信但twilio API无法识别。 我是否需要使用REST在我的应用中添加用户或手动通过twilio api验证?

我尝试按照this指南添加此类用户以获取我的authy_id

{
"api_key":"OaQi0sSxw9UVbJr234vGj0MOgdfZFkn5",
"email":"jxyz198@gmail.com",
"cellphone":"7989661708",
"country_code":"91"
}

但它要求authy id作为此响应的参数。

{
"error_code": "60004",
"message": "Invalid parameter: authy_id - Parameter is required",
"errors": {
    "message": "Invalid parameter: authy_id - Parameter is required"
},
"success": false
}

当我生成一个时,我怎么能提供authy_id?

1 个答案:

答案 0 :(得分:0)

用于创建用户的正确URL为: https://api.authy.com/protected/json/users/new

工作示例:

curl -X POST --data "api_key=YOUR_API_KEY&\
user[email]=new_user@email.com&\
user[cellphone]=405-342-5699&\
user[country_code]=1" \
https://api.authy.com/protected/json/users/new

响应:

{"message":"User created successfully.","user":{"id":48952},"success":true}

curl -X POST --data "api_key=YOUR_API_KEY&authy_id=48952"\
https://api.authy.com/protected/json/sdk/registrations

返回响应:

{"registration_token":"3D98vsvh4GcaZM4EVXt4RLQXvszM8NNo1lqftYv8czk","success":true}

您可以将此令牌用于SDK