语音聊天系统源码身份认证二要素介绍与实现流程一览

发布来源:云豹科技
发布人:云豹科技
2022-06-16 10:07:55

现如今语音聊天系统源码的用户群体不断扩大,各种事情都有可能在语音聊天系统源码上面发生,为了维护用户权益,只有通过实名认证的用户才有创建聊天室的权利,语音聊天系统源码是通过腾讯云,来实现用户的实名认证。

那么实名认证具体的实现过程是怎样的呢?下面代码是以thinkcmf框架为基础,所做的讲解,我们可以分为两步操作:

一、在腾讯云的官网进行下载SDK进行引入

链接: https://github.com/TencentCloud/tencentcloud-sdk-php

require_once CMF_ROOT.'vendor/autoload.php';
use TencentCloud\Common\Credential;
use TencentCloud\Common\Profile\ClientProfile;
use TencentCloud\Common\Profile\HttpProfile;
use TencentCloud\Common\Exception\TencentCloudSDKException;
use TencentCloud\Faceid\V20180301\FaceidClient;
use TencentCloud\Faceid\V20180301\Models\IdCardOCRVerificationRequest;

二、参考官网演示代码结合自己的程序进行编写代码

public function ceshi(){
$app_id='xxx';  //腾讯云id
$secret='xxx';  //腾讯云key
 
$name='测试';  //真实姓名
$idNo='400000000000000';  //身份账号
 
$cred = new Credential($app_id, $secret);
$httpProfile = new HttpProfile();
$httpProfile->setEndpoint("faceid.tencentcloudapi.com");
  
$clientProfile = new ClientProfile();
$clientProfile->setHttpProfile($httpProfile);
$client = new FaceidClient($cred, "ap-beijing", $clientProfile);
 
$req = new IdCardOCRVerificationRequest();
$params = '{"IdCard":"'.$IdCard.'","Name":"'.$name.'"}';
$req->fromJsonString($params);
 
 
$resp = $client->IdCardOCRVerification($req);
/*
返回数据格式:
{
  "Response": {
"Result": "0",
"Description": "姓名和身份证号一致",
"Name": "**杰",
"IdCard": "360*************50",
"Sex": "男",
"Nation": "汉",
"Birth": "1986/11/13",
"Address": "江西省九江市庐山河南路57号01室",
"RequestId": "a62f567c-1eea-4ef3-b51a-a9eb9bd84cd9"
  }
}
*/
print_r(json_decode($resp->toJsonString(),true));
}

这样我们就可以实现语音聊天系统源码的实名认证功能了,通过实名认证后,可以确认用户身份,避免出现网络诈骗的情况,同时也能保证用户资金账户更加安全,任何语音聊天系统源码都不能忽视这个功能。

声明:以上内容为云豹科技原创,未经作者本人同意,禁止转载,否则将追究相关法律责任www.yunbaokj.com

声明:
以上内容为云豹科技作者本人原创,未经作者本人同意,禁止转载,否则将追究相关法律责任