For user authentication, I am using the latest @azure/msal-angular package. This angular library is based on the latest MSAL library for AD authentication. But library throws an error given below:
ServerError: invalid_client: 7000218 - [2021-05-14 07:42:54Z]: AADSTS7000218: The request body must contain the following parameter: 'client_assertion' or 'client_secret'.
"@angular/core": "~10.2.4",
"@azure/msal-angular": "^2.0.0",
"@azure/msal-browser": "^2.14.1"
Configuration in app module.
{
auth: {
authority: 'https://login.microsoftonline.com/<tenant>/',
clientId: 'my client id',
redirectUri: 'http://localhost:4200',
postLogoutRedirectUri: 'http://localhost:4200/',
navigateToLoginRequestUrl: false
},
cache:{
cacheLocation: BrowserCacheLocation.LocalStorage
},
system: {
loggerOptions: {
loggerCallback,
logLevel: LogLevel.Info,
piiLoggingEnabled: false
}
}
}
Getting this error when executing below code in OnInit (app component)
this.msalService.instance.handleRedirectPromise().then(response => {
console.log('response', response);
if (response !== null && response.account !== null) {
this.msalService.instance.setActiveAccount(response.account);
}
});
Some blogs says like, to change the app type to public type. Is there any other option to resolve this issue?