public ActionResult Login(string email, string password) { var user = _usersProvider.Get(email, password); if (user == null) { throw new Exception("User does not exists."); } var userDto = new UserDto(user); var token = IdentitySignin(userDto); return(Json(new { accessToken = token, userName = userDto.Name })); }