微信小程序用户隐私保护指引fail api scope is not declared in the privacy agreement - /components/PrivacyPop/PrivacyPop
今天突然小程序登录不了,后台报错“The given payload is invalid.”但是小程序这边流程是正确的,绝对没错的,找了半天想起来看看wx.login的报错,结果显示:“fail api scope is not declared in the privacy agreement”,于是就去更新了用户协议,但是更新了还不对,才发现微信
于是就去查看这到底是什么东西 在components新增组件PrivacyPop
在login页引入:
import PrivacyPop from '../../components/PrivacyPop/PrivacyPop.vue';
components:{
PrivacyPop
},
async onLoad() {
this.wxLoginCode = await this.wxLogin();
this.$refs.PrivacyPopck.checkPrivacySetting();
},
这样就可以了 后面发现:checkPrivacySetting返回false的时候点击登录还是报错未授权,所以每次登录都得授权才能继续请求接口
好文推荐 拼多多帮助力入口