Incorrect Scopes doesn't lead to error when acquiring token #5142
Labels
b2c
Related to Azure B2C library-specific issues
b2c-service
Related to the Azure B2C service-specific issues
bug-unconfirmed
A reported bug that needs to be investigated and confirmed
msal-browser
Related to msal-browser package
msal-react
Related to @azure/msal-react
public-client
Issues regarding PublicClientApplications
question
Customer is asking for a clarification, use case or information.
Core Library
MSAL.js v2 (@azure/msal-browser)
Core Library Version
2.28.1
Wrapper Library
MSAL React (@azure/msal-react)
Wrapper Library Version
1.4.5
Public or Confidential Client?
Public
Description
When I call B2C to get an Access Token using incorrect scopes I would expect to get an error.
Currently it returns a response with an empty access token?
Error Message
No error - this is the issue
Msal Logs
simple issue, not required
MSAL Configuration
Relevant Code Snippets
Reproduction Steps
In your config add a 1 to the names of your scopes
"scopes": [
"https://xxxxxxx.onmicrosoft.com/web-portal/documents1.read",
"https://xxxxx.onmicrosoft.com/web-portal/appeals1.read"
]
Use the aquire token method
aquireAccessToken(instance, accounts[0], theScopes)
.then((res) => {
console.log('RES: ', res);
setTheToken(res.accessToken);
})
.catch((error) => {
console.log('Error: ', error);
if (
error instanceof InteractionRequiredAuthError ||
error instanceof BrowserAuthError
) {
instance.logoutRedirect();
}
});
Check the RES result printed out
Expected Behavior
An error should be thrown when trying to acquire an access token with invalid scopes as the method is called "aquireAccessToken" and this has failed
Identity Provider
Azure B2C Custom Policy
Browsers Affected (Select all that apply)
Chrome
Regression
No response
Source
External (Customer)
The text was updated successfully, but these errors were encountered: