public interface WxCpOAuth2Service
OAuth2相关管理接口. Created by BinaryWang on 2017/6/24.
文档1:https://developer.work.weixin.qq.com/document/path/91856
限定符和类型 | 方法和说明 |
---|---|
String |
buildAuthorizationUrl(String state)
构造oauth2授权的url连接.
|
String |
buildAuthorizationUrl(String redirectUri,
String state)
构造oauth2授权的url连接.
|
String |
buildAuthorizationUrl(String redirectUri,
String state,
String scope)
构造oauth2授权的url连接
详情请见: http://qydev.weixin.qq.com/wiki/index.php?
|
WxCpOauth2UserInfo |
getAuthUserInfo(String code)
获取用户登录身份
https://qyapi.weixin.qq.com/cgi-bin/auth/getuserinfo?
|
WxCpOauth2UserInfo |
getSchoolUserInfo(String code)
获取家校访问用户身份
该接口用于根据code获取家长或者学生信息
请求方式:GET(HTTPS)
请求地址:https://qyapi.weixin.qq.com/cgi-bin/school/getuserinfo?
|
WxCpSecondVerificationInfo |
getTfaInfo(String code)
获取用户二次验证信息
api: https://qyapi.weixin.qq.com/cgi-bin/auth/get_tfa_info?
|
WxCpUserDetail |
getUserDetail(String userTicket)
使用user_ticket获取成员详情
文档地址:https://developer.work.weixin.qq.com/document/path/95833
请求方式:POST(HTTPS)
请求地址:https://qyapi.weixin.qq.com/cgi-bin/auth/getuserdetail?
|
WxCpOauth2UserInfo |
getUserInfo(Integer agentId,
String code)
根据code获取成员信息
http://qydev.weixin.qq.com/wiki/index.php?
|
WxCpOauth2UserInfo |
getUserInfo(String code)
用oauth2获取用户信息
http://qydev.weixin.qq.com/wiki/index.php?
|
String buildAuthorizationUrl(String state)
构造oauth2授权的url连接.
state
- 状态码String buildAuthorizationUrl(String redirectUri, String state)
构造oauth2授权的url连接. 详情请见: http://qydev.weixin.qq.com/wiki/index.php?title=企业获取code
redirectUri
- 跳转链接地址state
- 状态码String buildAuthorizationUrl(String redirectUri, String state, String scope)
构造oauth2授权的url连接 详情请见: http://qydev.weixin.qq.com/wiki/index.php?title=企业获取code
redirectUri
- 跳转链接地址state
- 状态码scope
- 取值参考me.chanjar.weixin.common.api.WxConsts.OAuth2Scope类WxCpOauth2UserInfo getUserInfo(String code) throws WxErrorException
用oauth2获取用户信息 http://qydev.weixin.qq.com/wiki/index.php?title=根据code获取成员信息 因为企业号oauth2.0必须在应用设置里设置通过ICP备案的可信域名,所以无法测试,因此这个方法很可能是坏的。 注意: 这个方法使用WxCpConfigStorage里的agentId
code
- 微信oauth授权返回的代码WxErrorException
- 异常#getUserInfo(Integer, String)
WxCpOauth2UserInfo getUserInfo(Integer agentId, String code) throws WxErrorException
根据code获取成员信息 http://qydev.weixin.qq.com/wiki/index.php?title=根据code获取成员信息 https://work.weixin.qq.com/api/doc#10028/根据code获取成员信息 https://work.weixin.qq.com/api/doc#90000/90135/91023 获取访问用户身份 因为企业号oauth2.0必须在应用设置里设置通过ICP备案的可信域名,所以无法测试,因此这个方法很可能是坏的。 注意: 这个方法不使用WxCpConfigStorage里的agentId,需要开发人员自己给出
agentId
- 企业号应用的idcode
- 通过成员授权获取到的code,最大为512字节。每次成员授权带上的code将不一样,code只能使用一次,5分钟未被使用自动过期。WxErrorException
- 异常#getUserInfo(String)
WxCpOauth2UserInfo getSchoolUserInfo(String code) throws WxErrorException
请求方式:GET(HTTPS) 请求地址:https://qyapi.weixin.qq.com/cgi-bin/school/getuserinfo?access_token=ACCESS_TOKEN&code=CODE
code
- the codeWxErrorException
- the wx error exceptionWxCpUserDetail getUserDetail(String userTicket) throws WxErrorException
使用user_ticket获取成员详情 文档地址:https://developer.work.weixin.qq.com/document/path/95833 请求方式:POST(HTTPS) 请求地址:https://qyapi.weixin.qq.com/cgi-bin/auth/getuserdetail?access_token=ACCESS_TOKEN 注意: 原/cgi-bin/user/getuserdetail接口的url已变更为/cgi-bin/auth/getuserdetail,旧接口暂时还可以使用,但建议使用新接口 权限说明:需要有对应应用的使用权限,且成员必须在授权应用的可见范围内。 适用范围:企业内部开发、服务商代开发
userTicket
- 成员票据WxErrorException
- 异常WxCpOauth2UserInfo getAuthUserInfo(String code) throws WxErrorException
获取用户登录身份 https://qyapi.weixin.qq.com/cgi-bin/auth/getuserinfo?access_token=ACCESS_TOKEN&code=CODE 该接口可使用用户登录成功颁发的code来获取成员信息,适用于自建应用与代开发应用 注意: 旧的/user/getuserinfo 接口的url已变更为auth/getuserinfo,不过旧接口依旧可以使用,建议是关注新接口即可 适用范围:身份验证中网页授权开发和企业微信Web登录的获取用户登录身份
code
- 通过成员授权获取到的code,最大为512字节。每次成员授权带上的code将不一样,code只能使用一次,5分钟未被使用自动过期。WxErrorException
- 异常#getUserInfo(Integer, String)
WxCpSecondVerificationInfo getTfaInfo(String code) throws WxErrorException
api: https://qyapi.weixin.qq.com/cgi-bin/auth/get_tfa_info?access_token=ACCESS_TOKEN 权限说明:仅『通讯录同步』或者自建应用可调用,如用自建应用调用,用户需要在二次验证范围和应用可见范围内。 并发限制:20
code
- 用户进入二次验证页面时,企业微信颁发的code,每次成员授权带上的code将不一样,code只能使用一次,5分钟未被使用自动过期WxErrorException
Copyright © 2024. All rights reserved.