Ejemplo n.º 1
0
        /// <summary>
        /// Gets the authorize URL.
        /// </summary>
        /// <param name="consumerAppIdent">The consumer app ident.</param>
        /// <param name="returnUrl">The return URL.</param>
        /// <returns>Authorize URL.</returns>
        public string GetAuthorizeUrl(ConsumerAppIdent consumerAppIdent, string returnUrl)
        {
            var requestToken = OAuthUtility.GetRequestToken(
                consumerAppIdent.ConsumerKey, consumerAppIdent.ConsumerSecret, returnUrl);

            return(OAuthUtility.BuildAuthorizationUri(requestToken.Token).AbsoluteUri);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the OAuth token.
        /// </summary>
        /// <param name="consumerAppIdent">The consumer app ident.</param>
        /// <param name="requestToken">The request token.</param>
        /// <param name="requestVerifier">The request verifier.</param>
        /// <returns>OAuth token.</returns>
        public OAuthToken GetOAuthToken(ConsumerAppIdent consumerAppIdent, string requestToken, string requestVerifier)
        {
            var token = OAuthUtility.GetAccessToken(consumerAppIdent.ConsumerKey, consumerAppIdent.ConsumerSecret, requestToken, requestVerifier);

            return(new OAuthToken
            {
                ConsumerKey = consumerAppIdent.ConsumerKey,
                ConsumerSecret = consumerAppIdent.ConsumerSecret,
                Token = token.Token,
                TokenSecret = token.TokenSecret
            });
        }