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

[BUG] MGT4 prepscopes and custom apps/domains causes token corruption #3133

Open
nickjisc opened this issue Mar 6, 2024 · 1 comment
Open

Comments

@nickjisc
Copy link

nickjisc commented Mar 6, 2024

Describe the bug
When using prepscopes to call graph endpoints whilst having a custom app prep scope already obtained can result in the token for the custom app/domain becoming invalid and cannot be re-requested. Reverting to v3 of MGT fixes the issues.

To Reproduce
Steps to reproduce the behavior:

  1. Use a custom domain/app in a prepscope call
  2. prepscope with additional graph services
  3. attempt to call the custom domain/app api will result in a 401 error with the token being invalid

Expected behavior
Should work as with v3 of MGT, that a prepscope doesn't invalidate the custom domain/app api endpoint

Environment (please complete the following information):

  • OS: Windows (Web)
  • Browser: Edge
  • Framework: React
  • Context: Web (with mix of custom api (entra secured) and graph
  • Version: 4 latest
  • Provider: Msal2Provider
Providers.globalProvider = new Msal2Provider({
    clientId: "xxxxxx",
    loginType: LoginType.Redirect,
    redirectUri: window.location.protocol + "//" + window.location.host,
    scopes: ["user.read", "openid", "offline_access", "api://xxxxxxx/user"],
    customHosts: ["xxxxx", "service.powerapps.com", "api.bap.microsoft.com", "api.powerbi.com"]
});
Providers.client.api('some url').middlewareOptions(prepScopes(["api://xxxxxx/user"]))

then

Providers.client.api(`organization/${tenant!.id}`).middlewareOptions(prepScopes(["Directory.AccessAsUser.All",  "https://service.powerapps.com//User"])

and then back to the first call results in a 401 error

The same code (without the array brackets) works without issue in v3

@nickjisc nickjisc added bug Something isn't working Needs: Triage 🔍 labels Mar 6, 2024
@github-project-automation github-project-automation bot moved this to Needs Triage 🔍 in Graph Toolkit Mar 6, 2024
@nickjisc
Copy link
Author

still broken in the latest build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Needs Triage 🔍
Development

No branches or pull requests

2 participants