public IDataResult <AccessToken> RefreshAccessToken(string refreshToken)
        {
            var userControl = _userService.GetById(UserId);

            if (userControl.Data == null)
            {
                return(new ErrorDataResult <AccessToken>(Messages.InvalidToken));
            }

            var _refreshToken = _refreshTokenDal.Get(w => w.UserId == UserId && w.Token == refreshToken);

            if (_refreshToken == null)
            {
                return(new ErrorDataResult <AccessToken>(Messages.InvalidToken));
            }
            else if (!_refreshToken.IsActive)
            {
                _refreshTokenDal.Delete(_refreshToken);
                return(new ErrorDataResult <AccessToken>(Messages.TokenTimeOut));
            }

            _refreshTokenDal.Delete(_refreshToken);

            return(CreateAccessToken(userControl.Data));
        }
 public IResult Delete(RefreshToken refreshToken)
 {
     _refreshTokenDal.Delete(refreshToken);
     return(new SuccessResult());
 }