Example #1
0
        private string GetAccessTokenFromCache()
        {
            string token = CacheHelper.Get <string>("access_token");

            if (string.IsNullOrEmpty(token) == false)
            {
                JwtSecurityToken jwtToken = new JwtSecurityTokenHandler().ReadJwtToken(token);

                if (jwtToken.ValidTo < DateTime.Now)
                {
                    CacheHelper.Remove("access_token");
                    token = string.Empty;
                }
            }

            return(token);
        }