Beispiel #1
0
        protected virtual void Dispose(bool disposing)
        {
            if (_disposed)
            {
                if (disposing)
                {
                    AuthAgent.GetInstance().Stop();
                    _authToken = null;
                }

                _disposed = true;
            }
        }
Beispiel #2
0
        public AuthenticationInfoImplementation GetAuthToken()
        {
            if (_authToken == null)
            {
                _authToken = AuthAgent.GetInstance().Authenticate(GetRefreshToken(), isDemo: false);
                SetRefreshToken(_authToken.RefreshToken);
            }
            else if (!_authToken.IsValid)
            {
                _authToken.Reauthenticate();
                SetRefreshToken(_authToken.RefreshToken);
            }

            if (!_authToken.IsValid)
            {
                throw new Exception(string.Format("Couldn't authenticate with API. message: {0}", _authToken.ErrorMessage));
            }

            return(_authToken);
        }