예제 #1
0
 public static AuthInfo GetAuthInfo()
 {
     var authInfo = new AuthInfo
     {
         Access_Token = AccessToken,
         Config = GetConfig(),
     };
     return authInfo;
 }
예제 #2
0
        public InstagramAPIManager()
        {
            config = new InstaSharp.InstagramConfig(apiUri, oAuthUri, clientId, clientSecret, redirectUri);

            List<Auth.Scope> scopes = new List<Auth.Scope>();
            scopes.Add(Auth.Scope.basic);

            authInfo = GetInstagramAuth(oAuthUri, clientId, redirectUri, config, login, password);

        }
예제 #3
0
        public AuthInfo RequestToken(string code)
        {
            AuthInfo info = new AuthInfo();
            DataContractJsonSerializer serializer = new DataContractJsonSerializer(info.GetType());

            var parameters = new Dictionary<string, string>();
            parameters.Add("client_id", _config.ClientId);
            parameters.Add("client_secret", _config.ClientSecret);
            parameters.Add("grant_type", "authorization_code");
            parameters.Add("redirect_uri", _config.RedirectURI);
            parameters.Add("code", code);

            var result = HttpClient.POST(_config.OAuthURI + "/access_token", parameters);
               // MemoryStream ms = new MemoryStream(Encoding.Unicode.GetBytes(result))
            //var ret = serializer.ReadObject(ms) as AuthInfo;
            var ret = JsonConvert.DeserializeObject<AuthInfo>(result);
            //.Close();
            return (AuthInfo) ret;
        }