小程序用户授权调整

459 阅读1分钟

原因

处理

  • 通过 wx.getPrivacySetting 接口,查询微信侧记录的用户是否有待同意的隐私政策信息。该信息可通过返回结果 res 中的 needAuthorization 字段获取。
  • 调用 wx.openPrivacyContract 接口打开在小程序管理后台配置的《小程序用户隐私保护指引》,
  • 使用 <button open-type="agreePrivacyAuthorization" bindagreeprivacyauthorization="handleAgreePrivacyAuthorization">同意</button> 组件,当用户点击该组件后,表示用户已阅读并同意小程序的隐私政策等收集使用规则,微信会收到该同步信息。

与获取信息组件耦合使用

<button open-type="getPhoneNumber|agreePrivacyAuthorization" bindgetphonenumber="handleGetPhoneNumber" bindagreeprivacyauthorization="handleAgreePrivacyAuthorization">同意隐私协议并授权手机号</button>

<button open-type="getUserInfo|agreePrivacyAuthorization" bindgetuserinfo="handleGetUserInfo" bindagreeprivacyauthorization="handleAgreePrivacyAuthorization">同意隐私协议并获取头像昵称信息</button>

被动监听隐私接口需要用户授权事件

清空历史同步状态

  • 当用户从「微信下拉-最近-最近使用的小程序」中删除小程序,将清空历史同步状态。下次访问小程序后,需要重新同步微信当前用户已阅读并同意小程序的隐私政策等收集使用规则。

退出小程序方式

<navigator class="close" target="miniProgram" open-type="exit">
    退出当前小程序
</navigator>