Beispiel #1
0
        private void SetupClient(IDatabase database)
        {
            if (IsUsable(database))
            {
                TraktToken          token         = GetAuthToken(database);
                ITraktAuthorization authorization = TraktAuthorization.CreateWith(token.AccessToken, token.RefreshToken);
                Client.Authorization = authorization;

                RefreshAuthorization(database).Wait();
            }
            else
            {
                throw new Exception("Not authenticated");
            }
        }
Beispiel #2
0
 private void SaveAuthToken(IDatabase database, TraktToken token)
 {
     database.AddApiKey(new ApiKeySql {
         Id = ApiKeyName, ApiData = JsonConvert.SerializeObject(token)
     });
 }