指纹认证wx.startSoterAuthentication总是返回90007
发布于 6 年前 作者 cshi 13999 次浏览 来自 问答
  • 当前 Bug 的表现(可附上截图)

调用生物认证接口:

wx.startSoterAuthentication({ 
      requestAuthModes: ['fingerPrint'], 
      challenge: '123456', 
      authContent: '请用指纹解锁', 
      success(res) { 
        console.log('指纹成功', res); 
      }, 
      fail(res){ 
        console.log('指纹失败', res); 
      } 
})

但是,总是返回90007错误(在官方的小程序《小程序示例》中调用生物认证也是提示认证失败)

{
    authMode: "fingerPrint",
    resultJSON: "",
    resultJSONSignature: "",
    errCode: 90007,
    errMsg: "startSoterAuthentication:fail auth key update error"
}

附上另外2个接口的返回值情况:

wx.checkIsSupportSoterAuthentication({
      success(res) {
        console.log(res)
      }
 });
wx.checkIsSoterEnrolledInDevice({
      checkAuthMode: 'fingerPrint',
      success(res) {
        console.log(res)
      }
})
  • 预期表现

调用成功,出现指纹输入界面

  • 复现路径
  • 提供一个最简复现 Demo

查阅微信其他平台的开发文档,对错误说明如下:

不知道有没有也碰到这种情况的,该怎么解决?

4 回复

我的是这种情况:我手机储存了多个指纹,只有左手食指正常,其他的手指都报错:90007

解决了吗?nova3手机,平时用指纹打开微信,用指纹微信支付,但是调用这个接口就报错90007,另一台vivo手机正常。

其他的手机可以吗?

或者尝试检查系统更新,华为是否有新的系统更新包,或者已经支持微信指纹。iOS目前没有发现此问题。

附上代码,请参考:

let supportResult = await wepy.checkIsSupportSoterAuthentication().then(res => {
    var isSupportFinger = false;
    res.supportMode.forEach((item, index) => {
        if (item === 'fingerPrint') {
            isSupportFinger = true;
            return false;
        }
    });
 
    return isSupportFinger;
}).catch(() => {
    // 开发者工具不支持
    return false;
});
 
if (supportResult) {
    let enrolledResult = await wepy.checkIsSoterEnrolledInDevice({
        checkAuthMode: 'fingerPrint' //认证方式
    }).then(settingResult => {
        if (!settingResult.isEnrolled === false) {
            return { success: true, errMsg: '' }
        } else {
            return { success: false, errMsg: settingResult.errMsg }
        }
    });
 
    if (!enrolledResult.success === false) {
        // 本机已录入指纹信息
        let authResult = await wepy.startSoterAuthentication({
            requestAuthModes: ['fingerPrint'],
            challenge: 'fingerPrintSetting',
            authContent: '验证指纹提示语'
        }).then(enableResult => {
            return enableResult;
        }).catch(enableErrResult => {
            if (enableErrResult.errCode === 90008) {
                wepy.showToast({
                    title: '用户已取消', //提示的内容,
                    icon: 'none', //图标,
                    duration: 1000, //延迟时间,
                    mask: true //显示透明蒙层,防止触摸穿透
                });
            } else if (enableErrResult.errCode === 90009) {
                wepy.showToast({
                    title: '指纹验证失败', //提示的内容,
                    icon: 'none', //图标,
                    duration: 1000, //延迟时间,
                    mask: true //显示透明蒙层,防止触摸穿透
                });
            } else {
                wepy.showToast({
                    title: enableResult.errMsg, //提示的内容,
                    icon: 'none', //图标,
                    duration: 1000, //延迟时间,
                    mask: true //显示透明蒙层,防止触摸穿透
                });
            }
            return false;
        });
 
        if (!authResult === false) {
            // 将结果上传服务器传输给微信认证结果, TODO:目前服务端报 48001 错误,询问官方中
            wepy.showToast({
              title: '验证成功', // 提示的内容,
              icon: 'none', // 图标,
              duration: 1500, // 延迟时间,
              mask: true, // 显示透明蒙层,防止触摸穿透
            });
        }
    } else {
        wepy.showToast({
            title: settingResult.errMsg, // 提示的内容,
            icon: 'none', // 图标,
            duration: 1000, // 延迟时间,
            mask: true // 显示透明蒙层,防止触摸穿透
        });
    }
} else {
    wepy.showToast({
        title: '本机无法支持指纹识别', // 提示的内容,
        icon: 'none', // 图标,
        duration: 1000, // 延迟时间,
        mask: true // 显示透明蒙层,防止触摸穿透
    });
}
回到顶部