|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.foxinmy.weixin4j.api.BaseApi
com.foxinmy.weixin4j.mp.api.MpApi
com.foxinmy.weixin4j.mp.api.ComponentApi
public class ComponentApi
第三方应用组件
| Constructor Summary | |
|---|---|
ComponentApi(TicketManager ticketManager)
|
|
| Method Summary | |
|---|---|
ComponentAuthInfo |
exchangeAuthInfo(String authCode)
使用授权码换取公众号的接口调用凭据和授权信息:用于使用授权码换取授权公众号的授权信息, 并换取authorizer_access_token和authorizer_refresh_token。 授权码的获取,需要在用户在第三方平台授权页中完成授权流程后 ,在回调URI中通过URL参数提供给第三方平台方。请注意,由于现在公众号可以自定义选择部分权限授权给第三方平台 ,因此第三方平台开发者需要通过该接口来获取公众号具体授权了哪些权限,而不是简单地认为自己声明的权限就是公众号授权的权限。 |
ComponentAuthInfo |
getAuthInfo(String authAppId)
获取授权方的公众号帐号基本信息:获取授权方的公众号基本信息,包括头像、昵称、帐号类型、认证类型、微信号、原始ID和二维码图片URL。 需要特别记录授权方的帐号类型,在消息及事件推送时,对于不具备客服接口的公众号,需要在5秒内立即响应;而若有客服接口,则可以选择暂时不响应, 而选择后续通过客服接口来发送消息触达粉丝 |
OauthToken |
getAuthorizationToken(String authAppId,
String code)
第三方组件代替授权公众号发起网页授权:换取token |
AuthorizerOption |
getAuthorizerOption(String authAppId,
AuthorizerOption.AuthorizerOptionName optionName)
获取授权方的公众号的选项设置信息,如:地理位置上报,语音识别开关,多客服开关。注意,获取各项选项设置信息 |
TokenManager |
getPreCodeManager()
应用组件预授权码 |
PerTicketManager |
getRefreshTokenManager(String authAppId)
应用套组件永久刷新令牌:刷新令牌主要用于公众号第三方平台获取和刷新已授权用户的access_token,只会在授权时刻提供,请妥善保存。 一旦丢失,只能让用户重新授权,才能再次拿到新的刷新令牌 |
TicketManager |
getTicketManager()
应用组件ticket |
TokenManager |
getTokenManager()
应用组件token |
String |
getUserAuthorizationURL(String authAppId)
第三方组件代替授权公众号发起网页授权:获取code redirectUri默认填写weixin4j.properties#component.user.oauth.redirect.uri scope默认填写snsapi_base state默认填写state |
String |
getUserAuthorizationURL(String authAppId,
String redirectUri,
String scope,
String state)
第三方组件代替授权公众号发起网页授权:获取code |
OauthToken |
refreshAuthorizationToken(String authAppId,
String refreshToken)
第三方组件代替授权公众号发起网页授权:刷新token |
ApiResult |
setAuthorizerOption(String authAppId,
AuthorizerOption option)
设置授权方的公众号的选项信息,如:地理位置上报,语音识别开关,多客服开关。注意,获取各项选项设置信息 |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ComponentApi(TicketManager ticketManager)
ticketManager - 组件ticket存取| Method Detail |
|---|
public TokenManager getTokenManager()
public TicketManager getTicketManager()
public TokenManager getPreCodeManager()
public PerTicketManager getRefreshTokenManager(String authAppId)
authAppId - 授权方appid
public String getUserAuthorizationURL(String authAppId)
authAppId - 公众号的appid#getAuthorizationURL(String, String, String, String),
第三方组件代替授权公众号发起网页授权
public String getUserAuthorizationURL(String authAppId,
String redirectUri,
String scope,
String state)
authAppId - 公众号的appidredirectUri - 重定向地址,这里填写的应是服务开发方的回调地址scope - 应用授权作用域,snsapi_base/snsapi_userinfostate - 重定向后会带上state参数,开发者可以填写任意参数值,最多128字节
public OauthToken getAuthorizationToken(String authAppId,
String code)
throws WeixinException
authAppId - 公众号的appidcode - 用户同意授权获取的code
WeixinExceptiongetUserAuthorizationURL(String, String, String, String),
OauthToken
public OauthToken refreshAuthorizationToken(String authAppId,
String refreshToken)
throws WeixinException
authAppId - 公众号的appidrefreshToken - 填写通过access_token获取到的refresh_token参数
WeixinExceptiongetAuthorizationToken(String, String),
OauthApi.getAuthorizationUser(OauthToken),
OauthToken
public ComponentAuthInfo exchangeAuthInfo(String authCode)
throws WeixinException
authCode - 授权code
WeixinExceptioncom.foxinmy.weixin4j.mp.WeixinComponentProxy#getComponentAuthorizeURL(String, String, String)},
ComponentAuthInfo
public ComponentAuthInfo getAuthInfo(String authAppId)
throws WeixinException
authAppId - 授权方appid
WeixinExceptionComponentAuthInfo
public AuthorizerOption getAuthorizerOption(String authAppId,
AuthorizerOption.AuthorizerOptionName optionName)
throws WeixinException
authAppId - 授权方appidoption - 选项名称
WeixinExceptionAuthorizerOption
public ApiResult setAuthorizerOption(String authAppId,
AuthorizerOption option)
throws WeixinException
option - 选项信息
WeixinExceptionAuthorizerOption
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||