Beispiel #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))
            {
                NeteaseModel = JsonHelper.Deserialize <NeteaseModel>(json);
                return(NeteaseModel.Access_token);
            }
            throw new HttpException(500, "Get AccessToken failed!");
        }
Beispiel #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))
     {
         NeteaseModel = JsonHelper.Deserialize<NeteaseModel>(json);
         return NeteaseModel.Access_token;
     }
     throw new HttpException(500, "Get AccessToken failed!");
 }