如图:
https://api.weixin.qq.com 这个域名不是腾讯的吗,还需要配置在微信小程序后台?
我现在是想通过该接口来获取openid,如果这样不允许的话,我该如何获取openid:
getopenid:function(){ //获取openid
var that = this;
wx.login({
success: function (res) {
var d = that.globalData;//这里存储了appid、secret、token串
var url = ‘https://api.weixin.qq.com/sns/jscode2session?appid=’ + d.appid + ‘&secret=’ + d.secret + ‘&js_code=’ + res.code + ‘&grant_type=authorization_code’;
wx.request({
url: url,
method: ‘GET’,
success: function (res) {
that.globalData.openid = res.data.openid;
}
} //对应success
}); //对应wx.login
},