public WeixinAuthAccessTokenResult GetAuthAccessTokenResult(string code) { var url = WexinApiUrlBuilder.OAuth2_AccessTokenUrl(WeChatConfig.AppKey, WeChatConfig.AppSecuret, code); string notify, result; bool succ = HttpClientHelper.Get(url, out result, out notify); if (!succ) { return(null); } return(new WeixinAuthAccessTokenResult() { access_token = Tool.GetJosnValue(result, "access_token"), openid = Tool.GetJosnValue(result, "openid"), refresh_token = Tool.GetJosnValue(result, "refresh_token"), }); }
public WeixinAuthAccessTokenResult RefrashAuthAccessTokenResult(string refrash_token) { var url = WexinApiUrlBuilder.Refresh_TokenUrl(WeChatConfig.AppKey, refrash_token); string notify, result; bool succ = HttpClientHelper.Get(url, out result, out notify); if (!succ) { return(null); } string errorCode = Tool.GetJosnValue(result, "errcode"); if (!string.IsNullOrEmpty(errorCode)) { return(null); } return(JsonHelper.Get <WeixinAuthAccessTokenResult>(result)); }
public WeixinOAuth2UserInfoResult GetUserInfoByOpennIdAndAccessToken(string access_token, string openId) { var url = WexinApiUrlBuilder.OAuth2_UserinfoUrl(access_token, openId); string notify, result; bool succ = HttpClientHelper.Get(url, out result, out notify); if (!succ) { return(null); } string errorCode = Tool.GetJosnValue(result, "errcode"); if (!string.IsNullOrEmpty(errorCode)) { return(null); } return(JsonHelper.Get <WeixinOAuth2UserInfoResult>(result)); }
public string GetAuthCodeUrl(string redirectUrl) { return(WexinApiUrlBuilder.OAuth2_AuthorizeUrl(WeChatConfig.AppKey, redirectUrl, ScopeTypeEnum.snsapi_userinfo)); }