API: Factor/mobile - 运营商二要素


概览



factor/mobile 是 SUBMAIL 的简版身份验证 API,根据手机号和姓名验证是否为本人。



URL


<主> http://tpa.mysubmail.com/factor/mobile

<备> https://tpa.mysubmail.com/factor/mobile



支持格式


格式URL
jsonhttps://tpa.mysubmail.com/factor/mobile.json(默认)
xmlhttps://tpa.mysubmail.com/factor/mobile.xml


http 请求方式


请求方式content-type 设置
http postmultipart/form-datax-www-form-urlencodedapplication/json


请求参数


参数类型必需/可选默认描述
appidstring必需三要素 appid,自控制台获取
timestampstring必需时间戳
namestring必需待验证的身份证姓名
mobilestring必需待验证的号码
signaturestring必需sha256 加密校验数字证书


signature创建规则



1.请将以下参数按照字段升序(A-Z)排列
appkey、mobile、name、timestamp

2.创建签名字符串 :以"key=value" + "&"(连接符)+ "key=value" 的方式连接所有参数

3.创建签名:拼接签名字符串示例string = "appkey=xxxx&mobile=188xxxx&name=张三& timestamp=1602792765",然后使用sha256(string)创建签名

注:中文需要使用urlencode处理后再参与创建签名



代码示例


发送验证到


POST

http://tpa.mysubmailcom/factor/mobile

POST Data
appid=your_app_id
& timestamp=1602792765
&name=张三
&mobile=130xxxxxxxx
&signature=sha256加密后字符串


返回
{

​    "status":"success",

​    "result":{ 
                    'identical': True,
                    'msg': '一致'
            },

​    "send_id":"69639b23cbd2933746d87397bc379ab7"

}
status:接口请求状态    identical:认证结果,True一致/False不匹配  msg 认证结果描述  一致/不一致       send_id:唯一的请求标识


请求失败
{

​    "status": "error",

​    "code": 1210,

​    "msg": "Empty APP ID."

}
status:接口请求状态    code:错误代码    msg:错误信息


错误代码


参阅 API 错误代码