public async Task <CustomReturn <User> > GetInformationAsync() { var service = new UserRest(); var user = await service.GetInformationAsync(Account.Current.Token.AccessToken); return(user); }
public async Task <bool> Authenticate(LoginPageModel login) { ValidateLogin(login); var tokenService = new TokenRest(); var token = await tokenService.Login(login); if (token == null) { throw new Exception("Usuário ou Senha incorreta"); } var userService = new UserRest(); var userVm = await userService.GetInformationAsync(token.AccessToken); if (userVm == null) { throw new Exception("Usuário ou Senha incorreta"); } var userToken = new UserTokenVm { Token = token, User = userVm.Value }; Login(userToken); return(true); }