Beispiel #1
0
        private async Task <WinRtAuthorizer> Authenticate()
        {
            _credentials = await LocalDataCredentials.GetWinRtCredentialsAsync(ApplicationData.Current.LocalFolder);

            if (_credentials.ToString().Equals(",,,,,"))
            {
                _credentials.ConsumerKey    = "zPPDxXgf25WedMuVpYpw";
                _credentials.ConsumerSecret = "2Bad9VxQYzfsYDaowidBkoRBIq87wtjjFV8FAvcvV8";
                _credentials.AccessToken    = "32533776-uwuq1NLOaJSGdFH3qSrPjHp866I3lssiizrGQowXv";
            }
            _authorizer = new WinRtAuthorizer
            {
                Credentials    = _credentials,
                UseCompression = true,
                Callback       = new Uri("http://www.twittelytics.com")
            };
            if (!_authorizer.IsAuthorized)
            {
                Task <WinRtAuthorizer> task = _authorizer.AuthorizeAsync();
                await task.ContinueWith(t =>
                {
                    _authorizer.ScreenName = _credentials.ScreenName;
                    _authorizer.UserId     = _credentials.UserId;
                });

                if (_authorizer.IsAuthorized)
                {
                    return(task.Result);
                }
            }
            return(_authorizer);
        }
Beispiel #2
0
 public void Logout()
 {
     _credentials.Clear();
     _authorizer  = null;
     _credentials = null;
 }