Esempio n. 1
0
        /// <summary>
        /// Following the 3-legged authorization, you can exchange a request token for an access token
        /// using this method. This is the third and final step of the authorization process.
        /// </summary>
        /// <param name="verifier">The verification key received after the user has accepted the app.</param>
        /// <returns>An instance of <see cref="SocialOAuthAccessTokenResponse"/> representing the response.</returns>
        /// <see>
        ///     <cref>https://dev.twitter.com/docs/auth/3-legged-authorization</cref>
        /// </see>
        public virtual SocialOAuthAccessTokenResponse GetAccessToken(string verifier)
        {
            // Make the call to the API/provider
            SocialHttpResponse response = GetAccessTokenResponse(verifier);

            // Parse the response body
            SocialOAuthAccessToken body = SocialOAuthAccessToken.Parse(this, response.Body);

            // Parse the response
            return(SocialOAuthAccessTokenResponse.ParseResponse(response, body));
        }
        /// <summary>
        /// Following the 3-legged authorization, you can exchange a request token for an access token
        /// using this method. This is the third and final step of the authorization process.
        /// </summary>
        /// <param name="verifier">The verification key received after the user has accepted the app.</param>
        /// <returns>An instance of <see cref="SocialOAuthAccessTokenResponse"/> representing the response.</returns>
        /// <see>
        ///     <cref>https://dev.twitter.com/docs/auth/3-legged-authorization</cref>
        /// </see>
        public virtual SocialOAuthAccessTokenResponse GetAccessToken(string verifier)
        {
            // Some error checking
            if (String.IsNullOrWhiteSpace(verifier))
            {
                throw new ArgumentNullException(nameof(verifier));
            }

            // Make the call to the API/provider
            SocialHttpResponse response = GetAccessTokenResponse(verifier);

            // Parse the response body
            SocialOAuthAccessToken body = SocialOAuthAccessToken.Parse(this, response.Body);

            // Parse the response
            return(SocialOAuthAccessTokenResponse.ParseResponse(response, body));
        }
 /// <summary>
 /// Initializes a new instance from the specified <paramref name="response"/> and <paramref name="body"/>.
 /// </summary>
 /// <param name="response">The raw response.</param>
 /// <param name="body">The object representing the response body.</param>
 protected SocialOAuthAccessTokenResponse(SocialHttpResponse response, SocialOAuthAccessToken body) : base(response)
 {
     Body = body;
 }
 /// <summary>
 /// Initializes a new instance from the specified <paramref name="response"/> and <paramref name="body"/>.
 /// </summary>
 /// <param name="response">The raw response.</param>
 /// <param name="body">The object representing the response body.</param>
 /// <returns>An instance of <see cref="SocialOAuthAccessTokenResponse"/>.</returns>
 public static SocialOAuthAccessTokenResponse ParseResponse(SocialHttpResponse response, SocialOAuthAccessToken body)
 {
     return(response == null ? null : new SocialOAuthAccessTokenResponse(response, body));
 }
 /// <summary>
 /// Initializes a new instance from the specified <paramref name="response"/> and <paramref name="body"/>.
 /// </summary>
 /// <param name="response">The raw response.</param>
 /// <param name="body">The object representing the response body.</param>
 /// <returns>An instance of <see cref="SocialOAuthAccessTokenResponse"/>.</returns>
 public static SocialOAuthAccessTokenResponse ParseResponse(SocialHttpResponse response, SocialOAuthAccessToken body)
 {
     if (response == null)
     {
         throw new ArgumentNullException(nameof(response));
     }
     return(new SocialOAuthAccessTokenResponse(response, body));
 }