当前位置:网站首页>最佳实践 | 用腾讯云AI意愿核身为电话合规保驾护航
最佳实践 | 用腾讯云AI意愿核身为电话合规保驾护航
2022-07-07 11:33:00 【InfoQ】
一、准备工作
第一步:开通人脸核身服务

第二步:业务申请

第三步:了解腾讯云AI 意愿核身

第四步:意愿核身配置

第五步: 获取账号的云API密钥

二、接入意愿核身
第一步:给腾讯云AI 意愿核身授权

第二步:给腾讯云AI 意愿核身赋予开启实时播放/录制音视频流权限

第三步:给腾讯云AI 意愿核身域名添加白名单
- 需要将以下域名添加到 request 合法域名:https://events.tim.qq.com;https://faceid.qq.com;https://grouptalk.c2c.qq.com;https://pingtas.qq.com;https://web.sdk.qcloud.com;https://webim.tim.qq.com;https://yun.tim.qq.com;

第四步:初始化腾讯云AI 意愿核身SDK
//app.js
App({
onLaunch: function () {
// 初始化意愿核身组件
const Verify = require('/verify_mpsdk/main');
Verify.init();
}
})
// app.json
{
"pages":[
"verify_mpsdk/index/index"
]
}
第五步:后端接入腾讯云AI 意愿核身 实名核身鉴权接口
import com.tencentcloudapi.common.Credential;
import com.tencentcloudapi.common.profile.ClientProfile;
import com.tencentcloudapi.common.profile.HttpProfile;
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
import com.tencentcloudapi.faceid.v20180301.FaceidClient;
import com.tencentcloudapi.faceid.v20180301.models.*;
public class DetectAuth
{
public static void main(String [] args) {
try{
// 实例化一个认证对象,入参需要传入腾讯云账户secretId,secretKey,此处还需注意密钥对的保密
// 密钥可前往https://console.cloud.tencent.com/cam/capi网站进行获取
Credential cred = new Credential("SecretId", "SecretKey");
// 实例化一个http选项,可选的,没有特殊需求可以跳过
HttpProfile httpProfile = new HttpProfile();
httpProfile.setEndpoint("faceid.tencentcloudapi.com");
// 实例化一个client选项,可选的,没有特殊需求可以跳过
ClientProfile clientProfile = new ClientProfile();
clientProfile.setHttpProfile(httpProfile);
// 实例化要请求产品的client对象,clientProfile是可选的
FaceidClient client = new FaceidClient(cred, "", clientProfile);
// 实例化一个请求对象,每个接口都会对应一个request对象
DetectAuthRequest req = new DetectAuthRequest();
// 返回的resp是一个DetectAuthResponse的实例,与请求对象对应
DetectAuthResponse resp = client.DetectAuth(req);
// 输出json格式的字符串回包
System.out.println(DetectAuthResponse.toJsonString(resp));
} catch (TencentCloudSDKException e) {
System.out.println(e.toString());
}
}
}
第六步:进入意愿核身流程
// 单击某个按钮时,触发该函数
gotoVerify: function () {
// 去接入方服务端调用DetectAuth接口获取BizToken,需要接入方服务端自行实现
let BizToken = getBizToken();
// 调用实名核身功能
wx.startVerify({
data: {
token: BizToken // BizToken
},
success: (res) => { // 验证成功后触发
// res 包含验证成功的token
},
fail: (err) => { // 验证失败时触发
// err 包含错误码,错误信息
}
});
}
第七步:后端接入腾讯云AI 获取意愿核身结果接口
import com.tencentcloudapi.common.Credential;
import com.tencentcloudapi.common.profile.ClientProfile;
import com.tencentcloudapi.common.profile.HttpProfile;
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
import com.tencentcloudapi.faceid.v20180301.FaceidClient;
import com.tencentcloudapi.faceid.v20180301.models.*;
public class GetDetectInfoEnhanced
{
public static void main(String [] args) {
try{
// 实例化一个认证对象,入参需要传入腾讯云账户secretId,secretKey,此处还需注意密钥对的保密
// 密钥可前往https://console.cloud.tencent.com/cam/capi网站进行获取
Credential cred = new Credential("SecretId", "SecretKey");
// 实例化一个http选项,可选的,没有特殊需求可以跳过
HttpProfile httpProfile = new HttpProfile();
httpProfile.setEndpoint("faceid.tencentcloudapi.com");
// 实例化一个client选项,可选的,没有特殊需求可以跳过
ClientProfile clientProfile = new ClientProfile();
clientProfile.setHttpProfile(httpProfile);
// 实例化要请求产品的client对象,clientProfile是可选的
FaceidClient client = new FaceidClient(cred, "", clientProfile);
// 实例化一个请求对象,每个接口都会对应一个request对象
GetDetectInfoEnhancedRequest req = new GetDetectInfoEnhancedRequest();
// 返回的resp是一个GetDetectInfoEnhancedResponse的实例,与请求对象对应
GetDetectInfoEnhancedResponse resp = client.GetDetectInfoEnhanced(req);
// 输出json格式的字符串回包
System.out.println(GetDetectInfoEnhancedResponse.toJsonString(resp));
} catch (TencentCloudSDKException e) {
System.out.println(e.toString());
}
}
}
3、意愿核身效果展示
4、查询调用量


边栏推荐
- Cinnamon 任务栏网速
- MATLAB中polarscatter函数使用
- Scripy tutorial classic practice [New Concept English]
- LIS 最长上升子序列问题(动态规划、贪心+二分)
- Vscode编辑器ESP32头文件波浪线不跳转彻底解决
- 提升树莓派性能的方法
- MongoDB 遇见 spark(进行整合)
- Cloud detection 2020: self attention generation countermeasure network for cloud detection in high-resolution remote sensing images
- [QNX Hypervisor 2.2用户手册]6.3.4 虚拟寄存器(guest_shm.h)
- 分屏bug 小记
猜你喜欢
Cinnamon Applet 入门
聊聊伪共享
My "troublesome" subordinates after 00: not bad for money, against leaders, and resist overtime
Ogre introduction
存储过程的介绍与基本使用
Practical example of propeller easydl: automatic scratch recognition of industrial parts
Cinnamon taskbar speed
将数学公式在el-table里面展示出来
LED light of single chip microcomputer learning notes
靠卖概念上市,认养一头牛能走多远?
随机推荐
MongoDB内部的存储原理
Solve the cache breakdown problem
实现IP地址归属地显示功能、号码归属地查询
JNA learning notes 1: Concepts
High end for 8 years, how is Yadi now?
JS缓动动画原理教学(超细节)
Vscode编辑器ESP32头文件波浪线不跳转彻底解决
[learning notes] zkw segment tree
一文读懂数仓中的pg_stat
【学习笔记】线段树选做
cmake 学习使用笔记(一)
About how appium closes apps (resolved)
Ways to improve the performance of raspberry pie
Write it down once Net a new energy system thread surge analysis
Error lnk2019: unresolved external symbol
Storage principle inside mongodb
Navicat运行sql文件导入数据不全或导入失败
JNA学习笔记一:概念
Vscade editor esp32 header file wavy line does not jump completely solved
LeetCode_二分搜索_中等_153.寻找旋转排序数组中的最小值