Пример #1
0
        /// <summary>
        ///     Refreshes the live authentication access token if it has expired
        /// </summary>
        public static async Task <bool> RefreshAuthTokenIfNeeded()
        {
            var refreshed = false;

            if (AccessTokenExpiration.CompareTo(DateTimeOffset.UtcNow) <= 0)
            {
                await AttemptAccessTokenRefresh();

                refreshed = true;
            }
            return(refreshed);
        }
Пример #2
0
        public bool AccessTokenIsValid()
        {
            var timeValid = AccessTokenExpiration.CompareTo(DateTimeOffset.Now) > 0;

            return(!string.IsNullOrEmpty(AccessToken) && timeValid);
        }