Beispiel #1
0
        /// <summary>
        /// 获取全局Token
        /// </summary>
        /// <returns></returns>
        public static OAuthGlobalToken GetGlobalAccessToken()
        {
            string           Str = WeChatHttpUtility.GetJson(WeChatConfiguration.GlobalTokenUrl);
            OAuthGlobalToken Oauth_GlobalToken_Model = JsonConvert.DeserializeObject <OAuthGlobalToken>(Str);

            return(Oauth_GlobalToken_Model);
        }
Beispiel #2
0
        /// <summary>
        /// 获得用户信息
        /// </summary>
        /// <param name="accessToken"></param>
        /// <param name="openId"></param>
        /// <returns></returns>
        public static OAuthUser GetUserInfo(string accessToken, string openId)
        {
            string    Str             = WeChatHttpUtility.GetJson(string.Format(WeChatConfiguration.GetUserInfoUrl, accessToken, openId));
            OAuthUser OAuthUser_Model = JsonConvert.DeserializeObject <OAuthUser>(Str);

            return(OAuthUser_Model);
        }
Beispiel #3
0
        /// <summary>
        /// 获取Access Token获得,包括openId
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        public static OAuthToken GetAccessToken(string code)
        {
            string     Str = WeChatHttpUtility.GetJson(string.Format(WeChatConfiguration.AccessTokenUrl, code));
            OAuthToken Oauth_Token_Model = JsonConvert.DeserializeObject <OAuthToken>(Str);

            return(Oauth_Token_Model);
        }