public static OAuthAccessToken getOAuthAccessToken(String appId, String appSecret, String code) {
OAuthAccessToken token = null;
String tockenUrl = getOAuthTokenUrl(appId, appSecret, code);
JSONObject jsonObject = httpsRequest(tockenUrl, HttpMethod.GET, null);
if (null != jsonObject && !jsonObject.containsKey("errcode")) {
try {
token = new OAuthAccessToken();
token.setAccessToken(jsonObject.getString("access_token"));
token.setExpiresIn(jsonObject.getInteger("expires_in"));
token.setOpenid(jsonObject.getString("openid"));
token.setScope(jsonObject.getString("scope"));
} catch (JSONException e) {
token = null;//获取token失败
}
}else if(null != jsonObject){
token = new OAuthAccessToken();
token.setErrcode(jsonObject.getInteger("errcode"));
}
return token;
}
WxApi.java 文件源码
java
阅读 40
收藏 0
点赞 0
评论 0
项目:xxpay-master
作者:
评论列表
文章目录