当前位置:网站首页>最佳实践 | 用腾讯云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、查询调用量


边栏推荐
- My "troublesome" subordinates after 00: not bad for money, against leaders, and resist overtime
- JNA learning notes 1: Concepts
- Solve the cache breakdown problem
- About how appium closes apps (resolved)
- 高端了8年,雅迪如今怎么样?
- MongoDB复制(副本集)总结
- Cinnamon taskbar speed
- User management summary of mongodb
- Read PG in data warehouse in one article_ stat
- 一文读懂数仓中的pg_stat
猜你喜欢
LIS 最长上升子序列问题(动态规划、贪心+二分)
MySQL入门尝鲜
LIS longest ascending subsequence problem (dynamic programming, greed + dichotomy)
Error lnk2019: unresolved external symbol
Use of polarscatter function in MATLAB
DID登陆-MetaMask
Centso7 OpenSSL error Verify return code: 20 (unable to get local issuer certificate)
Isprs2021/ remote sensing image cloud detection: a geographic information driven method and a new large-scale remote sensing cloud / snow detection data set
QQ medicine, Tencent ticket
Per capita Swiss number series, Swiss number 4 generation JS reverse analysis
随机推荐
Storage principle inside mongodb
LeetCode_二分搜索_中等_153.寻找旋转排序数组中的最小值
QQ medicine, Tencent ticket
Ways to improve the performance of raspberry pie
Scrapy教程经典实战【新概念英语】
Custom thread pool rejection policy
Esp32 construction engineering add components
centso7 openssl 报错Verify return code: 20 (unable to get local issuer certificate)
How to make the new window opened by electorn on the window taskbar
Split screen bug notes
ESP32系列专栏
分布式事务解决方案
MongoDB的用户管理总结
Realbasicvsr test pictures and videos
How did Guotai Junan Securities open an account? Is it safe to open an account?
Introduce six open source protocols in detail (instructions for programmers)
Unity build error: the name "editorutility" does not exist in the current context
10 pictures open the door of CPU cache consistency
OSI 七层模型
Practical example of propeller easydl: automatic scratch recognition of industrial parts