static void InitUserAuthentication() { var requestToken = _twitterService.GetRequestToken(); var uri = _twitterService.GetAuthorizationUri(requestToken); Process.Start(uri.ToString()); Console.Write("For using your twitter account in application please enter verification code from twitter auth: "); var verifier = Console.ReadLine(); var userAccessToken = _twitterService.GetAccessToken(requestToken, verifier); _twitterService.AuthenticateWith(userAccessToken.Token, userAccessToken.TokenSecret); _isUserAuthenticated = true; }
public void Authorize(Func <Uri, string, string> func) { _twitterService = new TwitterService(_options.ConsumerKey, _options.ConsumerSecret); if (string.IsNullOrWhiteSpace(_options.OauthToken) && string.IsNullOrWhiteSpace(_options.OauthTokenSecret)) { var requestToken = _twitterService.GetRequestToken(); var uri = _twitterService.GetAuthenticationUrl(requestToken); var verifier = func(uri, "Введите PIN"); var access = _twitterService.GetAccessToken(requestToken, verifier); _options.SetOauthTokens(access.Token, access.TokenSecret); } _twitterService.AuthenticateWith(_options.OauthToken, _options.OauthTokenSecret); }
public void VerifyAuthorization(string verifier) { OAuthAccessToken access = service.GetAccessToken(requestToken, verifier); service.AuthenticateWith(access.Token, access.TokenSecret); }