Пример #1
0
 public AuthenticationInfo Do()
 {
     var client = new DebuggableYggdrasilClient(AuthServer, ClientToken);
     if (client.Authenticate(Email, Password, TwitchEnabled)) {
         return new AuthenticationInfo
         {
             AccessToken = client.AccessToken,
             UserType = client.AccountType,
             DisplayName = client.DisplayName,
             Properties = client.Properties,
             UUID = client.UUID
         };
     }
     return new AuthenticationInfo
     {
         Error = client.Error + ":" + client.ErrorMessage
     };
 }
Пример #2
0
 public Task<AuthenticationInfo> DoAsync(CancellationToken token)
 {
     var client = new DebuggableYggdrasilClient(AuthServer, ClientToken);
     return client.AuthenticateAsync(Email, Password, TwitchEnabled, token).ContinueWith(task =>
     {
         if ((task.Exception == null) && (task.Result))
         {
             return new AuthenticationInfo
             {
                 AccessToken = client.AccessToken,
                 UserType = client.AccountType,
                 DisplayName = client.DisplayName,
                 Properties = client.Properties,
                 UUID = client.UUID
             };
         }
         return new AuthenticationInfo
         {
             Error = client.Error + ":" + client.ErrorMessage
         };
     }, token);
 }