Commit 038c0b87b9d4c45e90b4fa4713ed27427431b820

Authored by YunaiV
1 parent c3aa2acd

增加微信登陆的测试页

yudao-user-server/src/main/resources/application-local.yaml
... ... @@ -160,9 +160,11 @@ yudao:
160 160 justauth:
161 161 enabled: true
162 162 type:
163   - WECHAT_MP: # 微信公众平台 - 移动端H5 https://mp.weixin.qq.com/debug/cgi-bin/sandboxinfo?action=showinfo&t=sandbox/index
  163 + WECHAT_MP: # 微信公众平台 - 移动端 H5 https://www.yuque.com/docs/share/a795bef6-ee8a-494a-8dc4-2ef41927743b?#%20%E3%80%8A%E5%BE%AE%E4%BF%A1%E5%85%AC%E4%BC%97%E5%8F%B7%E6%B5%8B%E8%AF%95%E3%80%8B
164 164 client-id: wxa5a05b85ac361f96
165 165 client-secret: 247073c7cebb67f27f0e769195c2a57e
  166 +# client-id: wx5b23ba7a5589ecbb # TODO 芋艿:自己的测试,后续可以删除
  167 +# client-secret: 2a7b3b20c537e52e74afd395eb85f61f
166 168 ignore-check-redirect-uri: true
167 169 extend:
168 170 enum-class: cn.iocoder.yudao.coreservice.modules.system.compent.justauth.AuthExtendSource
... ...
yudao-user-server/src/main/resources/static/social-login.html 0 → 100644
  1 +<!DOCTYPE html>
  2 +<html>
  3 +<head>
  4 + <meta charset="UTF-8">
  5 + <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"/>
  6 + <title>社交登陆测试页</title>
  7 + <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js"></script>
  8 +</head>
  9 +<body>
  10 +<div>点击如下按钮,发起登陆的测试</div>
  11 +<div>
  12 + <button id="wx_pub">微信公众号</button>
  13 +</div>
  14 +</body>
  15 +<script>
  16 + let server = 'http://127.0.0.1:28080';
  17 +
  18 + // 微信公众号
  19 + $( "#wx_pub").on( "click", function() {
  20 + // 获得授权链接
  21 + $.ajax({
  22 + url: server + "/api/social-auth-redirect?type=31&redirectUri=" +
  23 + encodeURIComponent(server + '/api/social-login-get'),
  24 + method: 'GET',
  25 + success: function( result ) {
  26 + if (result.code !== 0) {
  27 + alert('获得授权链接失败,原因:' + result.msg)
  28 + return;
  29 + }
  30 + // 跳转重定向
  31 + document.location.href = result.data;
  32 + }
  33 + })
  34 + });
  35 +</script>
  36 +</html>
... ...