仅供开发与测试。不校验 corpid/corpsecret/agentid,固定返回一个测试成员;签名私钥公开,任何人都能伪造令牌。生产系统绝不能信任此服务。
与企业微信官方网页扫码登录 输入输出一致:同名 WwLogin SDK、相同回跳 redirect_uri?code=&state=、相同的字段。所有端点收敛在 /wecom 下——把官方 base URL 换成 https://mock.authn.tech/wecom 即可。取用户信息按企业微信规范分三步:gettoken → auth/getuserinfo → user/get。
手机扫码或点二维码下方"模拟扫码"→"确认登录",页面会带 code 回跳到 /wecom/callback,并自动跑通 gettoken → getuserinfo → user/get。
<div id="ww_login"></div>
<script src="https://mock.authn.tech/wecom/wwLogin.js"></script>
<script>
new WwLogin({
id: "ww_login",
appid: "你的_corpid",
agentid: "你的_agentid",
redirect_uri: encodeURIComponent("https://your-app.example/callback"), // 官方约定:调用方 urlencode;回调会带 ?code=&state=
state: "任意防伪串",
redirect_type: "" // "callback"=iframe 内跳转,默认顶层窗口跳转
});
</script>
新版 @wecom/jssdk 的 ww.createWWLoginPanel({ params: { login_type:"CorpApp", appid, agentid, redirect_uri, state } }) 指向的是同一套 qrConnect 与 /cgi-bin/* 接口,把 base URL 换成 https://mock.authn.tech/wecom 即可。
| JS SDK | https://mock.authn.tech/wecom/wwLogin.js |
|---|---|
| 扫码页 | https://mock.authn.tech/wecom/sso/qrConnect |
| ① 取 access_token | https://mock.authn.tech/wecom/cgi-bin/gettoken?corpid=&corpsecret= |
| ② code 换 userid | https://mock.authn.tech/wecom/cgi-bin/auth/getuserinfo?access_token=&code= |
| ③ 查成员详情 | https://mock.authn.tech/wecom/cgi-bin/user/get?access_token=&userid= |
| (可选)敏感信息 | POST https://mock.authn.tech/wecom/cgi-bin/auth/getuserdetail?access_token=(body: { "user_ticket": "…" }) |
curl "https://mock.authn.tech/wecom/cgi-bin/gettoken?corpid=demo&corpsecret=x"
# → { errcode:0, access_token, expires_in }
curl "https://mock.authn.tech/wecom/cgi-bin/auth/getuserinfo?access_token=<AT>&code=<CODE>"
# → { errcode:0, userid, user_ticket }
curl "https://mock.authn.tech/wecom/cgi-bin/user/get?access_token=<AT>&userid=<USERID>"
# → { errcode:0, userid, name, department, mobile, email, ... }
| userid | zhangsan |
|---|---|
| name | 张三 |
| department | [1] |
| mobile | 13800000000 |