Configure B2C sample to work with PathLocationStrategy instead of HashLocationStrategy
See original GitHub issueLibrary
-
@azure/msal-angular@2.0.0-alpha.5
Description
How can I replicate the angular11-b2c-sample
project without turning on the HashLocationStrategy
?
The issue I’m facing is that redirect URIs from Azure AD B2C always start with #
which misses up the application because I’m using PathLocationStrategy
instead of HashLocationStrategy
.
I can set the useHash: false
instead of useHash: true
like this:
RouterModule.forRoot(routes, { useHash: false, // Don’t perform initial navigation in iframes initialNavigation: !isIframe ? ‘enabled’ : ‘disabled’, }),
But still, how can I interact with the redirect URIs starting with #
?
Source
- Customer request
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:7
Top Results From Across the Web
PathLocationStrategy vs HashLocationStrategy in web apps
For me the main difference is that the PathLocationStrategy requires a configuration on the server side to all the paths configured in ...
Read more >MSAL Angular FAQ - microsoft-authentication-library-for-js
How do I use my app with path/hash location strategy? How do I make sure all events ... Our Angular 10 sample demonstrates...
Read more >Configure authentication in a sample Angular SPA by using ...
This sample demonstrates how an Angular single-page application can use Azure AD B2C for user sign-up and sign-in. Then the app acquires an ......
Read more >Openid with Angular deployed to Azure Storage Static site ...
Therefore I had to enable hash location strategy to get it to work, by setting { useHash: true } in RouterModule.forRoot(routes) .
Read more >Location Strategy in Angular - TekTutorialsHub
Learn Location Strategy or Routing Strategy supported by Angular. The location strategies are. PathlocationStrategy and HashLocationStrategy.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@eluchsinger Thank you for your feedback regarding our samples. As we aim to provide samples that cover a wide range of use cases, we will look into updating our samples to demonstrate using the PathLocationStrategy as well as the HashLocationStrategy. We are also currently working on improving our documentation with better guidance regarding the nuances of using each strategy.
In the meantime, if you are wanting help with your app, it would be great if you either send us a link to your repo, or open an issue with your configuration, usage, MSAL version and logs. We would be happy to help figure out why the redirects are not working for you.
@shadyabouelmakarem
PathLocationStrategy
is fully supported by msal-angular. However, MSAL does not support redirectUris that have a hash, because that is where the response from the server is. MSAL will automatically handle parsing the response hash for you.Could you clarify what you mean by this?