早先HBuilder要求开发者在manifest.json的配置文件里填写需要微信登录的appId和appSecret。但是后来出于安全考虑,不再要求填写appSecret。
错误一:
[uni-id-co/ac1cd3741720950875803121890/554ms/ERROR] invalid code, rid: 6693a05d-5982011f-2ef8d54d
Error: invalid code, rid: 6693a05d-5982011f-2ef8d54d
at generateApiResult (/tmp/function/lib/third-party/weixin/normalize.js:10:11)
at callWxOpenApi (/tmp/function/lib/third-party/weixin/normalize.js:73:5)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7)
请求响应状态: success
解决方案:当使用unicloud的uni-id-co的公共模块进行开发的时候,需要在uni-config-center的配置文件里更改appId和appSecret。详细目录:uniCloud/cloudfunctions/common/uni-config-center/uni-id/config.json
错误二:
[uni-id-co/ac1cc2ff1720951289632176487/1365ms/ERROR] appid or provider invalid
Error: appid or provider invalid
at Object.FixOldKey (/tmp/function/@common_modules/uni-open-bridge-common/index.js:164:13)
at Object.Set (/tmp/function/@common_modules/uni-open-bridge-common/index.js:148:13)
at Object.setUserAccessToken (/tmp/function/@common_modules/uni-open-bridge-common/index.js:194:17)
at c.saveWeixinUserKey (/tmp/function/lib/utils/weixin.js:83:32)
at c.module.exports (/tmp/function/module/login/login-by-weixin.js:153:27)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7)
请求响应状态: fail
解决方案:配置好appId和appSecret后,如果还出现这个问题,需要上传更新下云公共模块uni-open-bridge-common。可能是uni-open-bridge-common不是最新版本,没有提供weixin-app的provider。
参考:https://ask.dcloud.net.cn/question/164447