@RestController
@AllArgsConstructor
@RequestMapping("/mp")
@Api(value = "首页显示", tags = "查询结果接口")
public class MpController {
public static final String URL_MP_AUTH = "https://api.weixin.qq.com/sns/jscode2session?appid=%s&secret=%s&js_code=%s&grant_type=authorization_code";
private final IWechatUserService wechatUserService;
private final SocialProperties socialProperties;
/**
* 微信授权登录
*/
@PostMapping("/login/{code}")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "微信授权登录", notes = "微信授权登录")
public R<WechatUser> login(@PathVariable String code) {
AuthConfig config = socialProperties.getOauth().get(AuthDefaultSource.WECHAT_MP);
String url = String.format(URL_MP_AUTH ,config.getClientId() ,config.getClientSecret() ,code);
ResponseEntity<String> entity = new RestTempla
微信授权登录,后端代码
猜你喜欢
转载自blog.csdn.net/weixin_42759398/article/details/131570825
今日推荐
周排行