com.belerweb.social.weixin.api
Class OAuth2

java.lang.Object
  extended by com.belerweb.social.API
      extended by com.belerweb.social.weixin.api.OAuth2

public final class OAuth2
extends API


Field Summary
 
Fields inherited from class com.belerweb.social.API
connect, t, weibo, weixin
 
Method Summary
 Result<AccessToken> accessToken(String code)
          通过code换取网页授权access_token。从Weixin中获取appId和secret。
 Result<AccessToken> accessToken(String appId, String secret, String code)
          通过code换取网页授权access_token。grantType值为authorization_code。
 Result<AccessToken> accessToken(String appId, String secret, String code, String grantType)
          通过code换取网页授权access_token
 String authorize()
          获取Authorization Code 从 Weixin 从获取clientId,redirectUri,responseType为code ,其余参数默认
 String authorize(Boolean wechatRedirect)
          获取Authorization Code 从 Weixin 从获取clientId,redirectUri,responseType为code ,其余参数默认
 String authorize(String redirectUri)
          获取Authorization Code 从 Weixin 从获取clientId,responseType为code ,scope为snsapi_userinfo,其余参数默认
 String authorize(String redirectUri, Boolean wechatRedirect)
          获取Authorization Code 从 Weixin 从获取clientId,responseType为code ,scope为snsapi_userinfo,其余参数默认
 String authorize(String appId, String redirectUri, String responseType, Scope scope, String state, Boolean wechatRedirect)
          获取Authorization Code 文档地址:http://mp.weixin.qq.com/wiki/index.php?title=网页授权获取用户基本信息
 Result<AccessToken> refreshAccessToken(String refreshToken)
          刷新access_token(如果需要)。从Weixin中获取appId
 Result<AccessToken> refreshAccessToken(String appId, String refreshToken)
          刷新access_token(如果需要)
 Result<AccessToken> refreshAccessToken(String appId, String grantType, String refreshToken)
          刷新access_token(如果需要)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

authorize

public String authorize()
获取Authorization Code 从 Weixin 从获取clientId,redirectUri,responseType为code ,其余参数默认

See Also:
OAuth2#authorize(String, String, String, String, String, Boolean)

authorize

public String authorize(Boolean wechatRedirect)
获取Authorization Code 从 Weixin 从获取clientId,redirectUri,responseType为code ,其余参数默认

See Also:
OAuth2#authorize(String, String, String, String, String, Boolean)

authorize

public String authorize(String redirectUri)
获取Authorization Code 从 Weixin 从获取clientId,responseType为code ,scope为snsapi_userinfo,其余参数默认

See Also:
OAuth2#authorize(String, String, String, String, String, Boolean)

authorize

public String authorize(String redirectUri,
                        Boolean wechatRedirect)
获取Authorization Code 从 Weixin 从获取clientId,responseType为code ,scope为snsapi_userinfo,其余参数默认

See Also:
OAuth2#authorize(String, String, String, String, String, Boolean)

authorize

public String authorize(String appId,
                        String redirectUri,
                        String responseType,
                        Scope scope,
                        String state,
                        Boolean wechatRedirect)
获取Authorization Code 文档地址:http://mp.weixin.qq.com/wiki/index.php?title=网页授权获取用户基本信息

Parameters:
appId - 必须,公众号的唯一标识
redirectUri - 必须,授权后重定向的回调链接地址
responseType - 必须,返回类型,请填写code
scope - 必须,应用授权作用域
state - 重定向后会带上state参数,开发者可以填写任意参数值
wechatRedirect - 直接在微信打开链接,可以不填此参数。做页面302重定向时候,必须带此参数

accessToken

public Result<AccessToken> accessToken(String code)
通过code换取网页授权access_token。从Weixin中获取appId和secret。

Parameters:
code - 填写第一步获取的code参数

accessToken

public Result<AccessToken> accessToken(String appId,
                                       String secret,
                                       String code)
通过code换取网页授权access_token。grantType值为authorization_code。

Parameters:
appId - 公众号的唯一标识
secret - 公众号的appsecret
code - 填写第一步获取的code参数

accessToken

public Result<AccessToken> accessToken(String appId,
                                       String secret,
                                       String code,
                                       String grantType)
通过code换取网页授权access_token

Parameters:
appId - 公众号的唯一标识
secret - 公众号的appsecret
code - 填写第一步获取的code参数
grantType - 填写为authorization_code

refreshAccessToken

public Result<AccessToken> refreshAccessToken(String refreshToken)
刷新access_token(如果需要)。从Weixin中获取appId

Parameters:
refreshToken - 填写通过access_token获取到的refresh_token参数

refreshAccessToken

public Result<AccessToken> refreshAccessToken(String appId,
                                              String refreshToken)
刷新access_token(如果需要)

Parameters:
appId - 公众号的唯一标识
refreshToken - 填写通过access_token获取到的refresh_token参数

refreshAccessToken

public Result<AccessToken> refreshAccessToken(String appId,
                                              String grantType,
                                              String refreshToken)
刷新access_token(如果需要)

Parameters:
appId - 公众号的唯一标识
grantType - 填写为refresh_token
refreshToken - 填写通过access_token获取到的refresh_token参数


Copyright © 2014. All Rights Reserved.