I have Register 2 application in Azour Ad ad following:
- SPA React Application.
- Web API application
I expose the web API custom scope as following:
And in the SPA application I add the permission as below:
After that in the React application I configure MSAL Login and it works fine but I face the following issue when I try to get the access token and specify the scope for the Web API scope I created before as code below:
function getAccessToken(){
console.log("get access token");
console.log("account user name " + accounts[0].username);
if (account) {
instance.acquireTokenSilent({
scopes: ['soe.all'],
account: account
}).then((response) => {
if (response) {
console.log(response.accessToken);
accessToken = response.accessToken;
}
});
}
}
I already Grant admin consent and the login is working fine but when I try to get the token it fails, I need the access token to start calling the Web API which will be a Spring Boot Rest API.