Beispiel #1
0
        public void ShouldGetRequestToken()
        {
            var requestToken = _oAuthService.GetRequestToken(_callbackUrl);

            Assert.IsNull(requestToken.OAuthProblem);
            Assert.IsTrue(requestToken.OAuthCallbackConfirmed);

            Console.WriteLine("token:  {0}\nsecret: {1}", requestToken.OAuthToken, requestToken.OAuthTokenSecret);

            var checkTokenResponse = _flickrApi.OAuthCheckToken(new OAuthCheckTokenParameters(requestToken.OAuthToken));
        }
        public ActionResult Authorize()
        {
            var uri = HttpContext.Request.Url;

            if (uri == null)
            {
                throw new ApplicationException("Request Url is null");
            }

            string callbackUrl     = Url.Action("callback", "oauth");
            var    applicationHome = uri.AbsoluteUri.Replace(uri.AbsolutePath, "");

            callbackUrl = applicationHome + callbackUrl;
            var requestToken = _oAuthService.GetRequestToken(callbackUrl);

            var userAuthorizationUrl = _oAuthUrlService.GetUserAuthorizationUrl(requestToken.OAuthToken);

            TempData["OAuthTokenSecret"] = requestToken.OAuthTokenSecret;

            return(Redirect(userAuthorizationUrl));
        }