public void GetRequestTokenForConsumerWithoutCallbackUrl()
		{
			var consumerContext = new OAuthConsumerContext {ConsumerKey = "key"};

			var session = new OAuthSession(consumerContext, "http://localhost/request", "http://localhost/userauth", "http://localhost/access");

			RequestDescription description = session.BuildRequestTokenContext("POST").GetRequestDescription();

			Assert.True(description.Body.Contains("oauth_callback=oob"));
		}
Exemple #2
0
        public ActionResult Start()
        {
            OAuthSession session = BuildSession();

            RequestDescription requestTokenRequest = session
                                                     .BuildRequestTokenContext("GET")
                                                     .GetRequestDescription();

            return(new RedirectResult(requestTokenRequest.Url.OriginalString));
        }
		public void GetRequestTokenForMethodGetDoesNotPopulateBody()
		{
			var consumerContext = new OAuthConsumerContext {ConsumerKey = "key"};

			var session = new OAuthSession(consumerContext, "http://localhost/request",
			                               "http://localhost/userauth", "http://localhost/access");

			RequestDescription description = session.BuildRequestTokenContext("GET").GetRequestDescription();

			Assert.Null(description.Body);
			Assert.Null(description.ContentType);
			Assert.Equal("GET", description.Method);
		}
Exemple #4
0
        //Launched when user clicks Get Sheets from Home view
        public ActionResult Start()
        {
            try
            {
                //From DevDefined library
                //Makes initial GET request to Smartsheet to display the authentication screen
                OAuthSession session = BuildSession();

                RequestDescription requestTokenRequest = session
                                                         .BuildRequestTokenContext("GET")
                                                         .GetRequestDescription();
                ViewBag.logout = false;

                return(new RedirectResult(requestTokenRequest.Url.OriginalString));
            }

            catch (WebException e)
            {
                //Stores the error message to the ViewBag so it can be displayed in the Failure view
                ViewBag.error = e.Message;
                return(View("Failure"));
            }
        }