Beispiel #1
0
        internal override HttpRequestMessage AddAuth(HttpRequestMessage request)
        {
            request.AddParameter("client_id", InstagramConfig.ClientId);
            request.AddParameter("client_secret", InstagramConfig.ClientSecret);

            return(request);
        }
Beispiel #2
0
        private HttpRequestMessage AddAuth(HttpRequestMessage request)
        {
            if (OAuthResponse == null)
            {
                request.AddParameter("client_id", InstagramConfig.ClientId);
            }
            else
            {
                request.AddParameter("access_token", OAuthResponse.Access_Token);
            }

            return(request);
        }
Beispiel #3
0
        internal virtual HttpRequestMessage AddAuth(HttpRequestMessage request)
        {
            if (!string.IsNullOrEmpty(OAuthResponse?.AccessToken))
            {
                request.AddParameter("access_token", OAuthResponse.AccessToken);
            }
            else
            {
                request.AddParameter("client_id", InstagramConfig.ClientId);
            }

            return(request);
        }
Beispiel #4
0
        public Task <OAuthResponse> RequestToken(string code)
        {
            HttpClient client = new HttpClient {
                BaseAddress = new Uri(_config.OAuthURI)
            };
            var request = new HttpRequestMessage(HttpMethod.Post, "access_token");

            request.AddParameter("client_id", _config.ClientId);
            request.AddParameter("client_secret", _config.ClientSecret);
            request.AddParameter("grant_type", "authorization_code");
            request.AddParameter("redirect_uri", _config.RedirectURI);
            request.AddParameter("code", code);

            return(client.ExecuteAsync <OAuthResponse>(request));
        }
 /// <param name="request"></param>
 private void AddSignature(HttpRequestMessage request)
 {
     if (EnforceSignedRequests && !String.IsNullOrWhiteSpace(InstagramConfig.ClientSecret))
     {
         request.AddParameter("sig", CreateRequestSignature(request));
     }
 }
Beispiel #6
0
 public static void AddParameter(this HttpRequestMessage request, string key, IFormattable value)
 {
     if (value != null)
     {
         request.AddParameter(key, value.ToString(null, CultureInfo.InvariantCulture));
     }
 }
        public HttpRequestMessage CreateRequest(HttpMethod method, string methodName)
        {
            var request = new HttpRequestMessage(method, string.Format("{0}/{1}", _webServiceUrl, methodName));

            // Add authentication token
            request.AddParameter("token", _token);

            return(request);
        }
Beispiel #8
0
        public Task <SubscriptionsResponse> Create(Object type, Aspect aspect)
        {
            // create a new guid that uniquely identifies this subscription request
            var verifyToken = Guid.NewGuid().ToString();
            var request     = new HttpRequestMessage {
                Method = HttpMethod.Post
            };

            request.AddParameter("client_id", config.ClientId);
            request.AddParameter("client_secret", config.ClientSecret);
            request.AddParameter("object", type.ToString().ToLower());
            request.AddParameter("aspect", aspect.ToString().ToLower());
            request.AddParameter("verify_token", verifyToken);
            request.AddParameter("callback_url", config.CallbackUri);

            return(client.ExecuteAsync <SubscriptionsResponse>(request));
        }