微信小程序如何获取accessToken
作者:互联网
其中appid和APPsecret是小程序的账号信息
附代码:
//获取accessToken
getAccessToken: function() {
var that = this;
var urlApi = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=' + this.APPID +
'&secret=' + this.APPSECRET;
wx.request({
url: urlApi,
data: {},
success(res) {
console.log("获取accessToken");
console.log(res.data);
uni.setStorageSync(that.ACCESSTOKEN, res.data.access_token)
}
})
},
标签:console,log,accessToken,微信,获取,res,var,data 来源: https://blog.csdn.net/LIXIAONA_1101/article/details/114631903