public SummaryPageViewModel(INavigationService navigationService, IConfiguration configuration) { Register = new DelegateCommand(RegisterPerson); _bypassSslHandler = new BypassSslValidationClientHandler(); _client = new HttpClient(_bypassSslHandler); _navigationService = navigationService; _configuration = configuration; }
public ListAccountsPageViewModel(IConfiguration configuration) { _configuration = configuration; _bypassSslHandler = new BypassSslValidationClientHandler(); _client = new HttpClient(_bypassSslHandler); AccountTappedCommand = new DelegateCommand <object>(AccountTapped); DeleteAccountCommand = new DelegateCommand(DeleteAccount, IsAuthorizedToDeleteAccount); DeleteAccountCommand.ObservesProperty(() => IdPassportInputValue); }
private void PerformTokenRequest(TokenRequest tokenRequest) { var handler = new BypassSslValidationClientHandler(); using (var httpClient = new HttpClient(handler, false)) { var request = new HttpRequestMessage { RequestUri = new Uri($"{NativeConstants.OPENID_BASE_URL}/token"), Method = HttpMethod.Post, Content = new FormUrlEncodedContent(new Dictionary <string, string> { { "client_id", NativeConstants.CLIENT_ID }, { "grant_type", "authorization_code" }, { "code", tokenRequest.AuthorizationCode }, { "code_verifier", tokenRequest.CodeVerifier }, { "redirect_uri", NativeConstants.REDIRECT_URI }, { "scope", "openid profile" } }) }; httpClient.SendAsync(request).ContinueWith((t) => { var httpResult = t.Result; if (!httpResult.IsSuccessStatusCode) { return; } httpResult.Content.ReadAsStringAsync().ContinueWith((st) => { var json = st.Result; var jObj = JObject.Parse(json); this.RunOnUiThread(() => { RefreshUi(jObj["id_token"].ToString(), jObj["access_token"].ToString()); }); }); }); } }