https://open.work.weixin.qq.com/wwopen/sso/qrConnect?appid=CORPID&agentid=AGENTID&redirect_uri=REDIRECT_URI&state=STATE
参数 | 必须 | 说明 |
---|---|---|
appid | 是 | 企业微信的CorpID,在企业微信管理端查看 |
agentid | 是 | 授权方的网页应用ID,在具体的网页应用中查看 |
redirect_uri | 是 | 重定向地址,需要进行UrlEncode |
state | 否 | 用于保持请求和回调的状态,授权请求后原样带回给企业。该参数可用于防止csrf攻击(跨站请求伪造攻击),建议企业带上该参数,可设置为简单的随机数加session进行校验 |
lang | 否 | 自定义语言,支持zh、en;lang为空则从Headers读取Accept-Language,默认值为zh |
若提示“该链接无法访问”,请检查参数是否填写错误,如redirect_uri的域名与网页应用的可信域名不一致。
若用户不在agentid所指应用的可见范围,扫码时会提示无权限。
redirect_uri?code=CODE&state=STATE
redirect_uri?state=STATE
假定当前企业CorpID:wxCorpId开启授权登录的应用ID:1000000登录跳转链接:http://api.3dept.comstate设置为:weblogin@gyoss9需要配置的授权回调域为:api.3dept.com根据URL规范,将上述参数分别进行UrlEncode,得到拼接的OAuth2链接为:https://open.work.weixin.qq.com/wwopen/sso/qrConnect?appid=wxCorpId&agentid=1000000&redirect_uri=http%3A%2F%2Fapi.3dept.com&state=web_login%40gyoss9
var wwLogin = new WwLogin({ "id": "wx_reg", "appid": "", "agentid": "", "redirect_uri": "", "state": "", "href": "", "lang": "zh",});
参数 | 必须 | 说明 |
---|---|---|
id | 是 | 企业页面显示二维码的DOM id |
appid | 是 | 企业微信的CorpID,在企业微信管理端查看 |
agentid | 是 | 授权方的网页应用ID,在具体的网页应用中查看 |
redirect_uri | 是 | 重定向地址,需要进行UrlEncode |
state | 否 | 用于保持请求和回调的状态,授权请求后原样带回给企业。该参数可用于防止csrf攻击(跨站请求伪造攻击),建议企业带上该参数,可设置为简单的随机数加session进行校验 |
href | 否 | 自定义样式链接,企业可根据实际需求覆 盖默认样式。详见文档底部FAQ |
lang | 否 | 自定义语言,支持zh、en;lang为空则从Headers读取Accept-Language,默认值为zh |
.impowerBox .qrcode {width: 200px;}.impowerBox .title {display: none;}.impowerBox .info {width: 200px;}.status_icon {display: none !important}.impowerBox .status {text-align: center;}