Skip to content

Instantly share code, notes, and snippets.

@manoj-choudhari-git
Created May 30, 2020 00:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save manoj-choudhari-git/db7a0f0d0f2b6e8ac367e5c3fbaaa06a to your computer and use it in GitHub Desktop.
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
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