Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect Scopes doesn't lead to error when acquiring token #5142

Closed
72gm opened this issue Aug 29, 2022 · 1 comment
Closed

Incorrect Scopes doesn't lead to error when acquiring token #5142

72gm opened this issue Aug 29, 2022 · 1 comment
Assignees
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.

Comments

@72gm
Copy link

72gm commented Aug 29, 2022

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

simple issue, not required

Relevant Code Snippets

simple issue, not required

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)

@72gm 72gm added bug-unconfirmed A reported bug that needs to be investigated and confirmed question Customer is asking for a clarification, use case or information. labels Aug 29, 2022
@ghost ghost added the Needs: Attention 👋 Awaiting response from the MSAL.js team label Aug 29, 2022
@github-actions github-actions bot added b2c Related to Azure B2C library-specific issues msal-browser Related to msal-browser package msal-react Related to @azure/msal-react public-client Issues regarding PublicClientApplications labels Aug 29, 2022
@ghost ghost assigned tnorling Aug 29, 2022
@derisen derisen added the b2c-service Related to the Azure B2C service-specific issues label Aug 29, 2022
@tnorling
Copy link
Collaborator

@72gm This is not something the MSAL SDK controls but rather the B2C service. Please open an issue with the B2C service. Instructions on how to do that can be found here

@ghost ghost removed the Needs: Attention 👋 Awaiting response from the MSAL.js team label Aug 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.
Projects
None yet
Development

No branches or pull requests

3 participants