后端接入文档

当用户通过智能验证码后,验证码服务会生成一个passtoken用于二次验证,用户的业务请求带上这个passtoken和客户端唯一标识utoken,业务系统再去请求二次验证接口,二次验证接口会返回passtoken的合法性和客户端设备指纹。如果业务系统可以采集提交业务参数的客户端ip和手机号,可以随passtoken一并提交,二次验证接口除了校验passtoken的合法性还会校验客户端的ip和手机号是否存在风险。

1.二次验证

接口地址:

http示例: http://apitj-bj.wuthreat.com/next_captcha/V2/ai_captcha/verify

https示例: https://apitj-bj.wuthreat.com/next_captcha/V2/ai_captcha/verify

请求方法: POST

请求类型: multipart/form-data

*注:

1、 一个业务系统需要对接多个渠道的SDK, 如:在PC业务中需要自适应H5(响应式),请注意不同渠道的AppKey及PassToken建议在API接口前传递参数时添加上验证项目的AppKey与PassToken 来区分渠道来源,用于在二次验证时进行区分正确的验证项目。

2、 为保证该功能的正常使用,需在无胁安全的三维身份验证模块将业务系统互联网出口IP地址添加至二次验证白名单。

请求参数:

参数名 类型 必填 示例值 参数说明
AppKey String 01HQ********RLO9 无胁安全平台创建验证码后得到的AppKey
AppToken String 10t5********ntz3 无胁安全平台创建验证码后得到的AppToken
Utoken String 57fc16587afe********951921ccbe30 验证成功后触发回调函数(success)返回的utoken
PassToken String 2sdc16587afe********uj2929cabev1 验证成功后触发回调函数(success)返回的passtoken,只可验证一次,使用即销毁。
IP String 1.180.13.77 ip地址,值可传递空字符
Phone String 13800138000 手机号,值可传递空字符
Timestamps String 1600000000 时间戳
identity String admin 身份信息

返回参数说明:

参数名 类型 示例值 参数说明
code Number 1 响应码
data Object / 返回数据
data.fingerprint String 52448469c07********0812d1b9b2ba6 设备指纹
data.ip Object / IP数据
data.ip.ip String 1.180.13.77 IP地址
data.ip.time String 2020-01-30 00:00:00 发现时间
data.ip.isp String 电信 IP运营商
data.ip.country String 中国 国家
data.ip.province String 内蒙古 省份
data.ip.city String 呼和浩特 城市
data.ip.risk Number 95.5 风险分值(0~100)
data.ip.risk_tag Array ["代理","恶意注册"] 风险标签
data.phone Object / 手机号数据
data.phone.phone_num String 13800138000 手机号码
data.phone.type String virtual 号码类型。public:公共卡号,virtual:虚拟卡号,iot:物联网卡号
data.phone.isp String 虚拟/移动 一级运营商
data.phone.isp1 String 分享通信 二级运营商
data.phone.frist_time String 2019-09-01 00:00:00 首次发现时间
data.phone.last_time String 2020-02-02 00:00:00 最后一次发现时间
data.phone.country String 中国 归属地国家
data.phone.province String 北京 归属地省份
data.phone.city String 北京 归属地城市
data.phone.risk Number 90 风险分值(0~100)
data.phone.risk_tag String 黑卡 风险标签
message String success 响应信息

返回示例:

  • 正常返回:

    例:{
            "code": "1", 
            "data": {
                "fingerprint": "52448469c07********0812d1b9b2ba6",
                "ip": {
                    "ip": "1.180.13.77",
                    "time": "2020-01-30 00:00:00",
                    "isp": "电信",
                    "country": "中国",
                    "province": "内蒙古",
                    "city": "呼和浩特",
                    "risk": 95.5,
                    "risk_tag": ["代理","恶意注册"]
                },
                "phone": {
                    "phone_num": "13800138000",
                    "type": "virtual",
                    "isp": "虚拟/移动",
                    "isp1": "分享通信",
                    "frist_time": "2019-09-01 00:00:00",
                    "last_time": "2020-02-02 00:00:00",
                    "country": "中国",
                    "province": "北京",
                    "city": "北京",
                    "risk": 99,
                    "risk_tag": ""
                }
            }
            "message": "success"
        } 
    
2.响应码解析

2.1 响应码列表

返回码 说明
1 二次认证效验成功
1099 认证失败
1112 IP格式错误
1113 手机号格式错误
1114 Utoken错误
1115 AppToken错误
1116 AppKey错误
3.示例代码

3.1 Python


    import requests
    data = {
        'AppKey': '01HQ********RLO9',
        'AppToken': '10t5********ntz3',
        'Utoken': '57fc16587afe********951921ccbe30',
        'PassToken': '2sdc16587afe********uj2929cabev1',
        'IP': '1.180.13.77',
        'Phone': '13800138000',
        'Timestamps': '1600000000'
    }
    
    # http接口
    # response = requests.post('http://apitj-bj.wuthreat.com/next_captcha/V2/ai_captcha/verify', data=data)
    # https接口
      response = requests.post('https://apitj-bj.wuthreat.com/next_captcha/V2/ai_captcha/verify', data=data)

3.2 Java


    // http接口
    // Request request = Request.Post("http://apitj-bj.wuthreat.com/next_captcha/V2/ai_captcha/verify");
    // https接口
      Request request = Request.Post("https://apitj-bj.wuthreat.com/next_captcha/V2/ai_captcha/verify");

    String body = "AppKey=01HQ********RLO9&AppToken=10t5********ntz3&Utoken=57fc16587afe********951921ccbe30&PassToken=2sdc16587afe********uj2929cabev1&IP=1.180.13.77&Phone=13800138000&Timestamps=1600000000";
    request.bodyString(body,ContentType.APPLICATION_FORM_URLENCODED);
    request.setHeader("Content-Type", "application/x-www-form-urlencoded");
    HttpResponse httpResponse = request.execute().returnResponse();
    System.out.println(httpResponse.getStatusLine());
    if (httpResponse.getEntity() != null) {
        String html = EntityUtils.toString(httpResponse.getEntity());
        System.out.println(html);
    }