微信公众号支付 在获得openid时 提示code无效
第一步:code
https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxa6dfd6b31996dcb2&redirect_uri=http%3A%2F%2Fdl.yywzyx.com%2Fyywzmj%2F&response_type=code&scope=snsapi_base#wechat_redirect
第二步:
用 上文的"code" ,换取网页授权access_token,并获得openid
https://api.weixin.qq.com/sns/oauth2/access_token?appid=***&secret=***&code="code"&grant_type=authorization_code
返回:{"errcode":40029,"errmsg":"invalid code, hints: [ req_id: UltvLa0451th29 ]"}
不知道哪里出了问题。
我在第二步时:设置code值为"code"(字符串), 因为第一步里面就是字符串code,是不是这里出了问题