Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void InputButton_Click(object sender, RoutedEventArgs e)
- {
- if (PasswordBox.Password != String.Empty && LoginBox.Text != String.Empty)
- {
- /*if (SaveLoginBox.IsChecked.Value)
- SaveLogin();
- else
- DeleteLogin();*/
- // discover endpoints from metadata
- var client = new HttpClient();
- var disco = client.GetDiscoveryDocumentAsync("http://localhost:5000");
- if (disco.IsFaulted)
- {
- MessageBox.Show("something wrong");
- return;
- }
- // request token
- var tokenResponse = client.RequestPasswordTokenAsync(new PasswordTokenRequest
- {
- Address = "http://localhost:5000/connect/token",
- ClientId = "ro.client",
- ClientSecret = "secret",
- UserName = "alice",
- Password = "Pass123$",
- Scope = "api1"
- });
- if (tokenResponse.IsFaulted)
- {
- MessageBox.Show("something wrong2");
- return;
- }
- MessageBox.Show(tokenResponse.ToString());
- AuthorizationGrid.Visibility = Visibility.Collapsed;
- MainGrid.Visibility = Visibility.Visible;
- SetDefault();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement