Пример #1
0
        //刷新Token(好像这个刷新Token没有实际作用)
        public static OAuth_Token refresh_token(string REFRESH_TOKEN)
        {
            string      Str = GetJson("https://api.weixin.qq.com/sns/oauth2/refresh_token?appid=" + appid + "&grant_type=refresh_token&refresh_token=" + REFRESH_TOKEN);
            OAuth_Token Oauth_Token_Model = JsonHelper.ParseFromJson <OAuth_Token>(Str);

            return(Oauth_Token_Model);
        }
Пример #2
0
        public static string appsecret = ConfigHelp.GetValueByNameInAppSettings("WeiXinAppSecret"); //52a8f2ebe0834ed8716b0d6bc5a88ecc智慧传播家公众微信平台下可以找到
        //public static string appid = "wx3fc1088ca9ad6fc5";  //传播家公众微信平台下可以找到
        //public static string appsecret = "c0ba51ab9ecab4a469f9e16ece6104d8";  //传播家公众微信平台下可以找到
        #endregion

        //根据appid,secret,code获取微信openid、access token信息
        public static OAuth_Token Get_token(string Code)
        {
            //获取微信回传的openid、access token
            string Str = GetJson("https://api.weixin.qq.com/sns/oauth2/access_token?appid=" + appid + "&secret=" + appsecret + "&code=" + Code + "&grant_type=authorization_code");
            //微信回传的数据为Json格式,将Json格式转化成对象

            OAuth_Token Oauth_Token_Model = JsonHelper.ParseFromJson <OAuth_Token>(Str);

            return(Oauth_Token_Model);
        }