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] v3 401 errors when using a custom api uri scope #2589

Closed
nickjisc opened this issue Jul 5, 2023 · 5 comments · Fixed by #2592
Closed

[BUG] v3 401 errors when using a custom api uri scope #2589

nickjisc opened this issue Jul 5, 2023 · 5 comments · Fixed by #2592
Labels

Comments

@nickjisc
Copy link

nickjisc commented Jul 5, 2023

Describe the bug
Updated from v2 to v3 and calls to AAD secured endpoints produces a 401 error with both and Providers.client.get("uri").

Providers.globalProvider = new Msal2Provider({
    clientId: 'yyyy',
    loginType: LoginType.Redirect,
    redirectUri: window.location.protocol + '//' + window.location.host,
    scopes: [
      'api://xxxx/User',
      'User.Read',
      "OpenId",
      "offline_access"
    ]
  });

then

            Providers.client.api(`xxxx/v1.0/Tenants/${jwt.tid}`)
                .get();

The above call produces a 401 error on v3 but v2 works fine. Same behaviour when using

<Get resource={`xxxx/v1.0/Tenants/${jwt.tid}`}>....</Get>
<Get resource='/me'>....</Get>

To Reproduce
Steps to reproduce the behavior:

  1. Upgrade from v2 to v3 of MGT.
  2. Add api scope to the beginning of scopes

If you add the api scope after the graph scopes, it fails to get that scope but graph scopes will work

Expected behavior
To continue to function as v2

Environment (please complete the following information):

  • OS: Windows (Web)
  • Browser: Chrome/Firefox
  • Framework: React
  • Context: Web
  • Version: 3
  • Provider: Msal2Provider

Additional context
Add any other context about the problem here.

@nickjisc nickjisc added bug Something isn't working Needs: Triage 🔍 labels Jul 5, 2023
@ghost
Copy link

ghost commented Jul 5, 2023

Hello nickjisc, thank you for opening an issue with us!

I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible. Other community members may also look into the issue and provide feedback 🙌

@nickjisc
Copy link
Author

nickjisc commented Jul 5, 2023

Recommend exposing the ability to set customHosts on the underlying graph client on init

@Mnickii
Copy link
Collaborator

Mnickii commented Jul 6, 2023

Hi @nickjisc, thanks for raising this and also for the recommendation on exposing the ability to set customHosts on the graph client. We will look into this and provide an update as soon as possible. We also really love community fixes, would you like to submit a PR for this?

@nickjisc
Copy link
Author

nickjisc commented Jul 6, 2023

I'll try and have a look, the PR will come from my personal account if I manage to do expose that config

@techienickb
Copy link
Contributor

Hopefully I've done #2592 right

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants