refactor(login): 调整微信公众号 OAuth2 登录流程- 注释掉原有的授权 URL生成和重定向逻辑
- 添加新的重定向 URL,包含额外参数和固定 code - 修改 wxmpOauth2 方法,使用测试数据进行登录
This commit is contained in:
@@ -170,8 +170,9 @@ public class LoginController {
|
||||
extra = "";
|
||||
}
|
||||
String configUrl = globalConfig.buildPath("/login/wxmp/oauth2/" + service + "?extra=" + extra);
|
||||
String authorizationUrl = platformWxmpConfig.buildAuthorizationUrl(service, configUrl, "snsapi_base");
|
||||
response.sendRedirect(authorizationUrl);
|
||||
// String authorizationUrl = platformWxmpConfig.buildAuthorizationUrl(service, configUrl, "snsapi_base");
|
||||
// response.sendRedirect(authorizationUrl);
|
||||
response.sendRedirect(configUrl+"&to=mobile&code=200");
|
||||
}
|
||||
|
||||
|
||||
@@ -181,9 +182,13 @@ public class LoginController {
|
||||
@RequestMapping("/wxmp/oauth2/{service}")
|
||||
@OperationIgnore
|
||||
public void wxmpOauth2(@PathVariable String service, CodeExtraDTO dto, HttpServletResponse response) {
|
||||
WxUserInfo wxUserInfo = platformWxmpConfig.getOAuth2AccessToken(service, dto.getCode());
|
||||
TokenBean tokenBean = corePlatformUniqueService.login(new DoLoginInfo(wxUserInfo.getAppId(),
|
||||
wxUserInfo.getOpenid(), "wxmp", JSON.toJSONString(wxUserInfo)));
|
||||
// WxUserInfo wxUserInfo = platformWxmpConfig.getOAuth2AccessToken(service, dto.getCode());
|
||||
// TokenBean tokenBean = corePlatformUniqueService.login(new DoLoginInfo(wxUserInfo.getAppId(),
|
||||
// wxUserInfo.getOpenid(), "wxmp", JSON.toJSONString(wxUserInfo)));
|
||||
TokenBean tokenBean = new TokenBean();
|
||||
tokenBean.setId("testid");
|
||||
tokenBean.setRoleId("testroleid");
|
||||
tokenBean.setExtra("testextra");
|
||||
corePlatformUniqueService.redirect(tokenBean, dto.getTo(), dto.getExtra(), response);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user