public class WxOAuth2ServiceImpl extends Object implements WxOAuth2Service
构造器和说明 |
---|
WxOAuth2ServiceImpl() |
限定符和类型 | 方法和说明 |
---|---|
String |
buildAuthorizationUrl(String redirectURI,
String scope,
String state)
构造oauth2授权的url连接.
|
WxMpOAuth2AccessToken |
getAccessToken(String code)
用code换取oauth2的access token.
|
protected WxMpConfigStorage |
getMpConfigStorage() |
WxMpUser |
getUserInfo(WxMpOAuth2AccessToken token,
String lang)
用oauth2获取用户信息, 当前面引导授权时的scope是snsapi_userinfo的时候才可以.
|
WxMpOAuth2AccessToken |
refreshAccessToken(String refreshToken)
刷新oauth2的access token.
|
boolean |
validateAccessToken(WxMpOAuth2AccessToken token)
验证oauth2的access token是否有效.
|
public String buildAuthorizationUrl(String redirectURI, String scope, String state)
WxOAuth2Service
构造oauth2授权的url连接. 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=网页授权获取用户基本信息
buildAuthorizationUrl
在接口中 WxOAuth2Service
redirectURI
- 用户授权完成后的重定向链接,无需urlencode, 方法内会进行encodescope
- scopestate
- statepublic WxMpOAuth2AccessToken getAccessToken(String code) throws WxErrorException
WxOAuth2Service
用code换取oauth2的access token. 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=网页授权获取用户基本信息
getAccessToken
在接口中 WxOAuth2Service
code
- codeWxErrorException
- .public WxMpOAuth2AccessToken refreshAccessToken(String refreshToken) throws WxErrorException
WxOAuth2Service
刷新oauth2的access token.
refreshAccessToken
在接口中 WxOAuth2Service
refreshToken
- 刷新tokenWxErrorException
- .protected WxMpConfigStorage getMpConfigStorage()
public WxMpUser getUserInfo(WxMpOAuth2AccessToken token, String lang) throws WxErrorException
WxOAuth2Service
用oauth2获取用户信息, 当前面引导授权时的scope是snsapi_userinfo的时候才可以.
getUserInfo
在接口中 WxOAuth2Service
token
- token对象lang
- zh_CN, zh_TW, enWxErrorException
- .public boolean validateAccessToken(WxMpOAuth2AccessToken token)
WxOAuth2Service
验证oauth2的access token是否有效.
validateAccessToken
在接口中 WxOAuth2Service
token
- token对象Copyright © 2020. All rights reserved.