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

Fix MSAL Angular MsalInterceptor bug matching to query string #7137

Merged
merged 9 commits into from
Jun 3, 2024

Conversation

jo-arroyo
Copy link
Collaborator

@jo-arroyo jo-arroyo commented May 31, 2024

This PR addresses a bug where the MsalInterceptor could match the protectedResource to the query string part of the URL instead of the host name and port part of the URL. It also refactors the code surrounding relative URLs.

This addresses issue #7111

@github-actions github-actions bot added msal-angular Related to @azure/msal-angular package msal-browser Related to msal-browser package labels May 31, 2024
@jo-arroyo jo-arroyo marked this pull request as ready for review May 31, 2024 18:56
@@ -906,9 +908,9 @@ describe("MsalInterceptor", () => {
sampleAccountInfo,
]);

httpClient.get("http://site.com/relative/me").subscribe();
httpClient.get("http://localhost:9876/relative/me").subscribe();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: This unit test needed to be fixed as it was providing a correct match where the host name and port were different in the case of a protected resource that was a relative URL.

@github-actions github-actions bot removed the msal-browser Related to msal-browser package label May 31, 2024
@jo-arroyo jo-arroyo merged commit 8e4b664 into dev Jun 3, 2024
8 checks passed
@jo-arroyo jo-arroyo deleted the angular-interceptor-query-fix branch June 3, 2024 16:50
@gcrockenberg
Copy link

My interceptor was no longer being invoked, or is no longer matching/inserting the bearer token after this update v3.0.19. Had to roll back. Is there new guidance on how to configure?

My protectedResource definitions specify relative paths (i.e. '/api/v1/User').

Thanks!

@jo-arroyo
Copy link
Collaborator Author

@gcrockenberg Relative paths should still work with the new update. Please open a new issue here with your configuration, paths, and protected resources for our investigation. Thank you.

@jano-kucera
Copy link

I've also had the same issue, I had to put in the full API address to MSAL_INTERCEPTOR_CONFIG for it to work again.

@jo-arroyo
Copy link
Collaborator Author

@jano-kucera Again, please open a new issue here with your configuration, paths, and protected resources for our investigation. Thank you.

abhixkj added a commit to abhixkj/microsoft-authentication-library-for-js that referenced this pull request Aug 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
msal-angular Related to @azure/msal-angular package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants