Esempio n. 1
0
        private async Task ExecuteLoginCommand()
        {
            try
            {
                var response = await _tokenClient.AuthAsync(email, password);

                try
                {
                    await SecureStorage.SetAsync("jwt_token", response.Token);

                    await SecureStorage.SetAsync("jwt_refreshtoken", response.RefreshToken);
                }
                catch (Exception ex)
                {
                    // Possible that device doesn't support secure storage on device.
                }

                _navigationService.PushMainPage <AppShell>();
            }
            catch (Exception ex)
            {
                await _popupService.DisplayAlertAsync("Failed to login", ex.Message,
                                                      new PopupAction("Cancel", null) { IsDefault = true });

                //await _popupService.DisplayAlertAsync("", "",
                //    new PopupAction("OK", null),
                //    new PopupAction("Cancel", null) { IsCancel = true });
            }
        }