The legacy ADAL library acquires a token by Clien App ID and Client Secret, something like:
var clientID = "";
var clientSecret = "";
var aadTenantDomain = "tenant domain";
var context = new AuthenticationContext(string.Format("https://login.windows.net/{0}", aadTenantDomain), false);
var clientCred = new Microsoft.IdentityModel.Clients.ActiveDirectory.ClientCredential(clientID, clientSecret);
var authenticationResult = await context.AcquireTokenAsync("https://graph.microsoft.com", clientCred).ConfigureAwait(false);
return authenticationResult.AccessToken;
Given AD app ClientId and Client Secret, how can I get an access token with MSAL?
Thank you!
Refer below code to get the access token from client Id and Client Secret.
Code:-
Output:-