处理微信公众号state问题

This commit is contained in:
wanggeng 2021-08-27 17:46:45 +08:00
parent 2625a30ec3
commit 46c30081c0

View File

@ -121,7 +121,7 @@ public class WechatOfficialAccountManager {
* @param session
*/
public void setUserAccessToken(String code, String state, HttpSession session) throws Exception {
if (StringUtils.equals(state, wechatOfficialAccountProperties.getAuthorize().getState())) {
if (StringUtils.startsWith(state, wechatOfficialAccountProperties.getAuthorize().getState())) {
WechatOfficialAccountAccessTokenForUser wechatOfficialAccountAccessTokenForUser = getUserAccessToken(code);
WechatOfficialAccountUserInfo wechatOfficialAccountUserInfo = getUserInfo(wechatOfficialAccountAccessTokenForUser.getAccess_token(), wechatOfficialAccountAccessTokenForUser.getOpenid());
WechatOfficialAccountUser wechatOfficialAccountUser = new WechatOfficialAccountUser();