详细说明--互联网用户账号信息如何做真实性认证(阿里云身份信息实名认证API接口)

【身份证实名认证接口-阿里云服务】【支持港澳台地区居住证】

2021年10月份国家互联网信息办公室公布《互联网用户账号名称信息管理规定(征求意见稿)》。内容包括,互联网用户账号服务平台应当按照“后台实名、前台自愿”的原则,要求互联网用户账号使用者在注册账号时提供真实身份信息。互联网用户账号使用者不提供真实身份信息或者虚假注册的,互联网用户账号服务平台不得为其提供服务。如何对用户提供的身份证信息进行真实性验证呢?

下面我们就介绍如何使用阿里云的实名认证服务:

1.注册阿里云账号并完成实名制认证(已有阿里云账号请略过)阿里云-上云就上阿里云 (aliyun.com)

2.购买测试套餐:https://market.aliyun.com/products/57126001/cmapi025518.htmlicon-default.png?t=N7T8https://market.aliyun.com/products/57126001/cmapi025518.html?#sku=yuncode19518000003.获取您的秘钥(appdoce):https://market.console.aliyun.com/imageconsole/index.htm?spm=5176.product-detail.J_3982476530.15.2b6217c1jFWWLt#/?_k=ld57ewicon-default.png?t=N7T8https://market.console.aliyun.com/imageconsole/index.htm?spm=5176.product-detail.J_3982476530.15.2b6217c1jFWWLt#/?_k=ld57ew4.编写接口代码(本例已java为例,产品页面有其他代码实例):

import java.io.IOException;
 
import okhttp3.Call;
import okhttp3.FormBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
 
public class id2demo {
 
	public static void main(String[] args) throws IOException {
        
        String url = "https://idenauthen.market.alicloudapi.com/idenAuthentication";
        // 获取appCode链接:https://market.console.aliyun.com/
        String appCode = "e1ff33s21dfg2s1dd2f1ff33fc60d7130";
        String name = "张三";
        String idNo = "320000198811110000";
 
        System.out.println(postData(appCode, url, name, idNo));
	}
	
	/**依赖的工具包有:okhttp-3.2.0.jar, okio-1.14.0.jar
	 * 工具包下载链接:https://download.csdn.net/download/ruidongjun007/88360015
	 * <dependency>
     *      <groupId>com.squareup.okhttp3</groupId>
     *      <artifactId>okhttp</artifactId>
     *      <version>3.2.0</version>
     *  </dependency>
     *  
     *  <dependency>
	 *  	<groupId>com.squareup.okio</groupId>
	 *  	<artifactId>okio</artifactId>
	 *  	<version>1.14.0</version>
	 *  </dependency>
	 */
	public static String postData(String appCode, String url, String name, String idNo) throws IOException {
		String result = "";
		RequestBody formBody = new FormBody.Builder().
        add("name", name).add("idNo", idNo).build();
		Request request = new Request.Builder().url(url).
        addHeader("Authorization", "APPCODE " + appCode).post(formBody).build();
		
		Call call = new OkHttpClient().newCall(request);
		Response response = null;
		try {
		    response = call.execute();
		} catch (IOException e) {
		    System.out.println("execute failed, message:" + e.getMessage());
		}
		
		assert response != null;
		if (!response.isSuccessful()) {
		    // 状态码为403时一般是套餐包用尽,需续购;
            // 注意:续购不会改变秘钥(appCode),仅增加次数
		    // 续购链接:https://market.aliyun.com/products/57000002/cmapi025518.html
		    System.out.println("request failed----" + "返回状态码" + response.code()  + 
              ",message:" + response.message());
		}
		result = response.body().string();
		
		return result;
	}
}

5.数据实例:

发送数据:

bodys.put("idNo", "340421190210182345");
bodys.put("name", "张三");

返回数据:

{
  "name": "张三",
  "idNo": "340421190710145412",
  "respMessage": "身份证信息匹配",
  "respCode": "0000",
  "province": "安徽省",
  "city": "淮南市",
  "county": "凤台县",
  "birthday": "19071014",
  "sex": "M",
  "age": "111"
}

阿里云在国内拥有强大的技术沉淀,保证了接口的稳定服务,同时可以在线申请发票、合同等服务也为大家的工作节省大量时间,


希望大家搬砖快乐!

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值