public class WxCpOAuth2ServiceImpl extends Object implements WxCpOAuth2Service
oauth2相关接口实现类. Created by Binary Wang on 2017-6-25.
| 构造器和说明 |
|---|
WxCpOAuth2ServiceImpl() |
| 限定符和类型 | 方法和说明 |
|---|---|
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?
|
WxCpUserDetail |
getUserDetail(String userTicket)
使用user_ticket获取成员详情.
|
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?
|
public String buildAuthorizationUrl(String state)
WxCpOAuth2Service构造oauth2授权的url连接.
buildAuthorizationUrl 在接口中 WxCpOAuth2Servicestate - 状态码public String buildAuthorizationUrl(String redirectUri, String state)
WxCpOAuth2Service构造oauth2授权的url连接. 详情请见: http://qydev.weixin.qq.com/wiki/index.php?title=企业获取code
buildAuthorizationUrl 在接口中 WxCpOAuth2ServiceredirectUri - 跳转链接地址state - 状态码public String buildAuthorizationUrl(String redirectUri, String state, String scope)
WxCpOAuth2Service构造oauth2授权的url连接 详情请见: http://qydev.weixin.qq.com/wiki/index.php?title=企业获取code
buildAuthorizationUrl 在接口中 WxCpOAuth2ServiceredirectUri - 跳转链接地址state - 状态码scope - 取值参考me.chanjar.weixin.common.api.WxConsts.OAuth2Scope类public WxCpOauth2UserInfo getUserInfo(String code) throws WxErrorException
WxCpOAuth2Service用oauth2获取用户信息 http://qydev.weixin.qq.com/wiki/index.php?title=根据code获取成员信息 因为企业号oauth2.0必须在应用设置里设置通过ICP备案的可信域名,所以无法测试,因此这个方法很可能是坏的。 注意: 这个方法使用WxCpConfigStorage里的agentId
getUserInfo 在接口中 WxCpOAuth2Servicecode - 微信oauth授权返回的代码WxErrorException - 异常WxCpOAuth2Service.getUserInfo(Integer, String)public WxCpOauth2UserInfo getUserInfo(Integer agentId, String code) throws WxErrorException
WxCpOAuth2Service根据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,需要开发人员自己给出
getUserInfo 在接口中 WxCpOAuth2ServiceagentId - 企业号应用的idcode - 通过成员授权获取到的code,最大为512字节。每次成员授权带上的code将不一样,code只能使用一次,5分钟未被使用自动过期。WxErrorException - 异常WxCpOAuth2Service.getUserInfo(String)public WxCpUserDetail getUserDetail(String userTicket) throws WxErrorException
WxCpOAuth2Service使用user_ticket获取成员详情. 文档地址:https://work.weixin.qq.com/api/doc#10028/%E4%BD%BF%E7%94%A8user_ticket%E8%8E%B7%E5%8F%96%E6%88%90%E5%91%98%E8%AF%A6%E6%83%85 请求方式:POST(HTTPS) 请求地址:https://qyapi.weixin.qq.com/cgi-bin/user/getuserdetail?access_token=ACCESS_TOKEN 权限说明: 需要有对应应用的使用权限,且成员必须在授权应用的可见范围内。
getUserDetail 在接口中 WxCpOAuth2ServiceuserTicket - 成员票据WxErrorException - 异常Copyright © 2021. All rights reserved.