question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Configure B2C sample to work with PathLocationStrategy instead of HashLocationStrategy

See original GitHub issue

Library

  • @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:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:7

github_iconTop GitHub Comments

2reactions
jo-arroyocommented, Mar 10, 2021

@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.

2reactions
jo-arroyocommented, Feb 26, 2021

@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.

But still, how can I interact with the redirect URIs starting with # ?

Could you clarify what you mean by this?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found