示例#1
0
        /// <summary>
        /// Step 3 of the oAuth protocol process
        /// Make a request on the provider to Exchange a <see cref="RequesToken"/> for an <see cref="AccessToken"/>
        /// (Step 2 is a simple redirect and so there is no method for it in this class)
        /// </summary>
        /// <param name="accessTokenEndpoint">The url (as per the provider) to use for making a requet to Exchange a request token for an access token</param>
        /// <param name="realm">Typically the url of Your "application" or website</param>
        /// <param name="consumerKey">The Consumer Key given to you by the provider</param>
        /// <param name="consumerSecret">The Consumer Secret given to you by the provider</param>
        /// <param name="token">The token you got at the end of Step 1 or Step 2</param>
        /// <param name="verifier">The verifier you got at the end of step 2</param>
        /// <param name="tokenSecret">The tokenSecret you got at the end of step 1</param>
        /// <param name="signatureMethod">defaults to HMAC-SHA1 - the only signature method currently supported</param>
        /// <returns>An instance of a <see cref="AccessToken"/> class</returns>
        public AccessToken GetOAuthAccessToken(string accessTokenEndpoint, string realm, string consumerKey, string consumerSecret, string token, string verifier, string tokenSecret, SignatureMethod signatureMethod = SignatureMethod.HMACSHA1)
        {
            var oAuthUtils          = new OAuthUtils();
            var authorizationHeader = oAuthUtils.GetAccessTokenAuthorizationHeader(accessTokenEndpoint, realm, consumerKey, consumerSecret, token, verifier, tokenSecret, signatureMethod);

            return(MakeRequest <AccessToken>(accessTokenEndpoint, authorizationHeader));
        }