Example #1
0
        public void GetToken(string authorizationCode)
        {
            NameValueCollection data = new NameValueCollection();

            data.Add("grant_type", "authorization_code");
            data.Add("client_id", consumer_key);
            data.Add("client_secret", consumer_secret);
            data.Add("redirect_uri", redirect_url);
            data.Add("code", authorizationCode);
            WebClient wc = new WebClient();

            Byte[] resData = wc.UploadValues(MIXI_TOKEN_ENDPOINT, data);
            string resText = Encoding.UTF8.GetString(resData);
            Dictionary <string, object> result = MixiAPIClient.JsonToDictionary(resText);

            token        = result["access_token"].ToString();
            refreshToken = result["refresh_token"].ToString();
        }
Example #2
0
        public static void Main(string[] args)
        {
            MixiAPIClient client = new MixiAPIClient(CONSUMER_KEY,CONSUMER_SECRET,REDIRECT_URL);

            Console.WriteLine("1. Open this url and allow your application access.");
            Console.WriteLine(client.GetAuthorizeUrl());

            Console.WriteLine("2. Input 'code' parameter value of redirected url.");
            string code = Console.ReadLine();
            client.GetToken(code);

            Console.WriteLine("----");
            string resText = client.Call("/people/@me/@self");
            Dictionary<string,object> result = MixiAPIClient.JsonToDictionary(resText);
            Dictionary<string,object> entry = (Dictionary<string, object>)result["entry"];
            foreach(string key in entry.Keys){
                Console.WriteLine(key + " : " + entry[key]);
            }
        }
Example #3
0
        public static void Main(string[] args)
        {
            MixiAPIClient client = new MixiAPIClient(CONSUMER_KEY, CONSUMER_SECRET, REDIRECT_URL);

            Console.WriteLine("1. Open this url and allow your application access.");
            Console.WriteLine(client.GetAuthorizeUrl());

            Console.WriteLine("2. Input 'code' parameter value of redirected url.");
            string code = Console.ReadLine();

            client.GetToken(code);

            Console.WriteLine("----");
            string resText = client.Call("/people/@me/@self");
            Dictionary <string, object> result = MixiAPIClient.JsonToDictionary(resText);
            Dictionary <string, object> entry  = (Dictionary <string, object>)result["entry"];

            foreach (string key in entry.Keys)
            {
                Console.WriteLine(key + " : " + entry[key]);
            }
        }