uniapp 获取code错误
https://developers.weixin.qq.com/doc/oplatform/Website_App/WeChat_Login/Authorized_Interface_Calling_UnionID.html
uni.login({
provider: "weixin",
onlyAuthorize: true
}).then(res => {
res = this.$determine(res)
this.errmsg=JSON.stringify(res)
if (res.errMsg == 'login:ok') {
console.log('code',res.code)
}
获取code,给后端,提示code 无效
后端请求:
http请求方式: GET
https://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_code
返回:
{"errcode":40029,"errmsg":"invalid code, rid: 624e907f-08656c40-47262de6"}