Created
May 30, 2020 00:12
-
-
Save manoj-choudhari-git/db7a0f0d0f2b6e8ac367e5c3fbaaa06a to your computer and use it in GitHub Desktop.
Azure AD and MSAL - API Scope added while signing in in WPF Application
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private async void SignInButton_Click(object sender, RoutedEventArgs e) | |
{ | |
string[] scopes = new string[] { "user.read", "api://5e999e55-a661-4982-b897-965480492129/access_as_user" }; | |
AuthenticationResult authResult = null; | |
var app = App.PublicClientApp; | |
try | |
{ | |
ResultText.Text = ""; | |
authResult = await (app as PublicClientApplication).AcquireTokenInteractive(scopes) | |
.ExecuteAsync(); | |
DisplayBasicTokenInfo(authResult); | |
UpdateSignInState(true); | |
} | |
catch (Exception ex) | |
{ | |
ResultText.Text = $"Error Acquiring Token:{Environment.NewLine}{ex}"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment