Esempio n. 1
0
        protected override string QueryAccessToken(Uri returnUrl, string authorizationCode)
        {
            var dict = new Dictionary <string, string>();

            dict["code"]          = authorizationCode;
            dict["client_id"]     = this.appId;
            dict["client_secret"] = this.appSecret;
            dict["redirect_uri"]  = returnUrl.AbsoluteUri.UrlEncode();
            dict["grant_type"]    = "authorization_code";
            var json = WebRequestExtensions.Post(TokenEndpoint, dict);

            if (!string.IsNullOrEmpty(json))
            {
                RenrenModel = JsonHelper.Deserialize <RenrenModel>(json);
                return(RenrenModel.Access_token);
            }
            throw new HttpException(500, "Get AccessToken failed!");
        }
Esempio n. 2
0
 protected override string QueryAccessToken(Uri returnUrl, string authorizationCode)
 {
     var dict = new Dictionary<string, string>();
     dict["code"] = authorizationCode;
     dict["client_id"] = this.appId;
     dict["client_secret"] = this.appSecret;
     dict["redirect_uri"] = returnUrl.AbsoluteUri.UrlEncode();
     dict["grant_type"] = "authorization_code";
     var json = WebRequestExtensions.Post(TokenEndpoint, dict);
     if (!string.IsNullOrEmpty(json))
     {
         RenrenModel = JsonHelper.Deserialize<RenrenModel>(json);
         return RenrenModel.Access_token;
     }
     throw new HttpException(500, "Get AccessToken failed!");
 }