request:fail url not in domain list就获取openid时候错 ?

小程序 文章 2021-12-31 12:00 15 0 全屏看文

request:fail url not in domain list就获取openid时候错 ?When request:fail url not in domain list gets openid wrong?

request:fail url not in domain list就获取openid时候错 ?
let _this = this	uni.login({	provider: 'weixin',	success: function(res) {let appid = _this.appid	let secret =  _this.secret	let url = 'https://api.weixin.qq.com/sns/jscode2session?appid=' + appid + '&secret=' + secret + '&js_code=' +	res.code + '&grant_type=authorization_code';												console.info(url);	uni.request({	url: url, // 请求路径	success: result => {	console.info(result.data.openid);		_this.userinfo.openid = result.data.openid;			//_this.gologin();		},	fail(err) {	console.info(err);			}});},	fail(err) {		console.info(err);	}});		

let _this = this uni.login({ provider: 'weixin', success: function(res) {let appid = _this.appid let secret =  _this.secret let url = 'https://api.weixin.qq.com/sns/jscode2session?appid=' + appid + '&secret=' + secret + '&js_code=' + res.code + '&grant_type=authorization_code'; console.info(url); uni.request({ url: url, // 请求路径 success: result => { console.info(result.data.openid); _this.userinfo.openid = result.data.openid; //_this.gologin(); }, fail(err) { console.info(err); }});}, fail(err) { console.info(err); }});

回答:

zhang嘉宾:

放到服务器上获取openid 也不行!

Mr.Zhao:不行是怎么个不行,学会提问
Mr.Zhao:

-EOF-