收藏
回答

encryptedData中无unionID?

问题模块
API和组件


{
    "openId": "OPENID",
    "nickName": "NICKNAME",
    "gender": GENDER,
    "city": "CITY",
    "province": "PROVINCE",
    "country": "COUNTRY",
    "avatarUrl": "AVATARURL",
    "unionId": "UNIONID",
    "watermark":
    {
        "appid":"APPID",
    "timestamp":TIMESTAMP
    }
}

官方文档中对encryptedData解密后的数据结构如上,但是我在dev环境中解密的结果,并没有拿到unionId.



此处获取到的user包含encryptedData信息。然后this.getAccount的方法是将iv跟encryptedData上传至服务器解密。

wx.getUserInfo({
            withCredentials: true,
            success: (user) => {
              this.getAccount(user.encryptedData, user.iv)
                .then((account) => {
                  this._user = <User> user.userInfo;
                  this._user.account = account;
                  this.store();
                  resolve(this._user);
                })
                .catch(() => {
                  reject();
                });
            },
            fail: () => {
              console.log('failed');
              reject();
            },
            complete: () => {
              wx.hideLoading();
            }
          });

解密结果:

{ openId: 'obIwK0d6tIohLqXnvU9J2km1_XR4',
  nickName: '乔治林',
  gender: 1,
  language: 'zh_CN',
  city: '',
  province: '',
  country: 'CN',
  avatarUrl: 'xxxx',
  watermark: { timestamp: 1491535474, appid: 'xxxxxxx' } }


最后一次编辑于  2017-04-07  (未经腾讯允许,不得转载)
邀请回答
复制链接收藏关注问题回答

1 个回答