Ejemplo n.º 1
0
        public async Task <BaseResponse <AccessToken> > CreateAccessToken(string email, string password)
        {
            BaseResponse <User> userResponse = await _userService.FindByEmailandPassword(email, password);

            if (userResponse.Success)
            {
                AccessToken accessToken = _tokenHandler.CreateAccesToken(userResponse.Extra);

                _userService.SaveRefreshToken(userResponse.Extra.Id, accessToken.RefreshToken);

                return(new BaseResponse <AccessToken>(accessToken));
            }
            else
            {
                return(new BaseResponse <AccessToken>(userResponse.ErrorMessage));
            }
        }