小程序 - 人脸核验遇到的问题 startFacialRecognitionVerifyAndUploadVideo:fail:access denied

报错 - 没有权限

{"errno": 102, "errMsg": "startFacialRecognitionVerifyAndUploadVideo:fail:access denied"}

在这里插入图片描述

代码

import Taro, {
    
     Component } from '@tarojs/taro'

class Home extends Component {
    
    
	constructor(props) {
    
    
		super(props)
	}
	state = {
    
    
		result: 'cs ',
	}
	componentDidMount() {
    
    
		console.log('111111----', 111111)
		const that = this
		// Taro.startFacialRecognitionVerifyAndUploadVideo({
    
    
		Taro.startFacialRecognitionVerify({
    
    
			name: '测试名', // 真实姓名
			idCardNumber: '330xxx19xxxxxxxx', // 真实身份证号码
			success(res) {
    
    
				console.log('res--success--', res)
				that.setState({
    
    
					result: 'success',
				})
			},
			fail(res) {
    
    
				console.log('res--fail--', res)
				that.setState({
    
    
					result: 'fail',
				})
			},
			complete(res) {
    
    
				console.log('res--complete--', res)
				// that.setState({
    
    
				// 	result: 'complete',
				// })
			},
		})
	}
	componentWillUnmount() {
    
    }

	config = {
    
    
		navigationBarTitleText: '扫脸',
	}

	render() {
    
    
		return <View className='AI-Content'>测试{
    
    this.state.result}</View>
	}
}

解决

微信公众各平台 开通人脸核验权限
在这里插入图片描述
提交资料后会展示 申请中 → 等待审核
在这里插入图片描述

【补充】

  • 如果人脸核验开通之后,调用API还是报错 {"errno": 102, "errMsg": "startFacialRecognitionVerifyAndUploadVideo:fail:access denied"} ,核对一下调用的API和已开通API是否一致(我调用的Taro.startFacialRecognitionVerifyAndUploadVideo()还会报错,查看文档之后使用Taro.startFacialRecognitionVerify() 调用正常)
    在这里插入图片描述

  • 有其他问题可添加微信群,询问工作人员
    在这里插入图片描述

接口调用正常页面展示

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/m0_53562074/article/details/132411573