在做微信公众号网页授权的时候,有时会重定向两次网页(302问题),会导致code被使用两次,报40163错误--code have been usered 为了解决问题,我们可以在跳转授权页面加上connect_redirect=1。 //1、跳转授权页面 String path = CommonUtils.REDIRECT_URL +"weixin/getUserInfo"; String url = "/connect/oauth2/authorize?" + "app&redirect_uri=" + path + "&response_type=code" + "&scope=snsapi_userinfo" + "&state=STATE&connect_redirect=1#wechat_redirect";