protected virtual async Task<KeyPair> GetRequestToken(IWebAuthenticator authorizer) { var oauthClient = new OAuthClient(ApplicationInfo); var resp = await oauthClient.Ajax(UrlGetRequestToken, parameters: new HttpParameters { { "oauth_callback", (await authorizer.GetCallback()).ToString() } }, dataType: DataType.UrlEncoded ); if (resp.oauth_callback_confirmed != "true") throw new ProtocolException("Expected oauth_callback_confirmed to be true"); return new KeyPair( key: resp.oauth_token, secret: resp.oauth_token_secret ); }
protected virtual async Task<KeyPair> GetAccessToken(KeyPair requestToken, string oAuthVerifier) { var oauthClient = new OAuthClient(ApplicationInfo, requestToken); var resp = await oauthClient.Ajax(UrlGetAccessToken, parameters: new HttpParameters { { "oauth_verifier", oAuthVerifier } }, dataType: DataType.UrlEncoded); return new KeyPair( key: resp.oauth_token, secret: resp.oauth_token_secret ); }