Пример #1
0
 /// <summary>
 /// <para>Constructs the User Authorization URL that a user can be forwarded to in order to authorize the Unauthorized Request Token.</para>
 /// </summary>
 /// <param name="requestToken">The Request Token associated with your OAuth</param>
 /// <param name="callBackUrl">The callback URL that the browser should be redirected to once the User inputs credentials at the User Authorization URL</param>
 /// <returns>User Authorization URL</returns>
 public string GetAuthorizationUrl(OAuthToken requestToken, string callBackUrl)
 {
     if (requestToken == null && string.IsNullOrEmpty(this.OAuthTokenKey))
         throw new Exception("Can not get OpenQQ Authorization URL without a Request Token");
     if (requestToken == null)
         requestToken = new RequestToken(this.OAuthConsumer, this.OAuthTokenKey, this.OAuthTokenSecret);
     return ((RequestToken)(this.RequestToken)).GetAuthorizeUrl(callBackUrl, ConsumerKey);
 }
Пример #2
0
        /// <summary>
        /// <para>Exchanges a User-Authorized Request Token for an Access Token.</para>
        /// </summary>
        /// <param name="requestToken">User-Authorized Request Token</param>
        /// <returns>Access Token</returns>
        public OAuthToken GetAccessToken(OAuthToken requestToken)
        {
            if (requestToken == null && string.IsNullOrEmpty(this.OAuthTokenKey) && string.IsNullOrEmpty(this.OAuthTokenSecret))
                throw new Exception("Can not get OAuth Access Token without User-Authorized Request Token");
            if (requestToken == null)
            {
                requestToken = new RequestToken(this.OAuthConsumer, this.OAuthTokenKey, this.OAuthTokenSecret);
                requestToken.OAuthVericode = this.OAuthVericode;
            }
            this.RequestToken = requestToken;

            this.AccessToken = ((RequestToken)(this.RequestToken)).GetAccessToken(null);
            return this.AccessToken;
        }