static WebAuthenticationResult()
 {
     UserCancel = new WebAuthenticationResult
     {
         ResponseStatus = WebAuthenticationStatus.UserCancel
     };
 }
Esempio n. 2
0
        protected virtual void ReadUserAuthorizationResult(WebAuthenticationResult userAuthResult, out string oAuthToken, out string oAuthVerifier)
        {
            if (userAuthResult.ResponseStatus == WebAuthenticationStatus.UserCancel)
                throw new TaskCanceledException();
            if (userAuthResult.ResponseStatus == WebAuthenticationStatus.ErrorHttp)
                throw new WebException(userAuthResult.ResponseErrorDetail, userAuthResult.ResponseData);

            var responseData = userAuthResult.ResponseData.ParseUrlParameters();

            if (!responseData.TryGetValue("oauth_token", out oAuthToken))
                throw new ProtocolException("Server did not return oauth_token");

            if (!responseData.TryGetValue("oauth_verifier", out oAuthVerifier))
                throw new ProtocolException("Server did not return oauth_verifier");
        }