Exemplo 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));
        }
Exemplo n.º 2
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)
        {
            // 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));
        }