public void LoadWebBrowser(WebBrowser browser) { var authorizer = new OAuthAuthorizer(AppBootstrapper.ConsumerKey, AppBootstrapper.ConsumerSecret); authorizer.GetRequestToken("https://api.twitter.com/oauth/request_token") .Select(x => x.Token) .DispatcherSubscribe( token => { _token = token; string url = authorizer.BuildAuthorizeUrl("https://api.twitter.com/oauth/authorize", token); browser.Navigate(new Uri(url)); }, OnError); }
/// <summary>Asynchronously gets the access token.</summary> public IObservable <TokenResponse <AccessToken> > GetAccessToken(string accessTokenUrl, RequestToken requestToken, string verifier) { Enforce.NotNull(accessTokenUrl, "accessTokenUrl"); Enforce.NotNull(requestToken, "requestToken"); Enforce.NotNull(verifier, "verifier"); var verifierParam = new KeyValuePair <string, object>("oauth_verifier", verifier); var parameters = ConstructBasicParameters(accessTokenUrl, MethodType.Post, requestToken, verifierParam); parameters.Add(verifierParam); return(GetTokenResponse(accessTokenUrl, parameters, (key, secret) => new AccessToken(key, secret))); }