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.

/#code becomes anchor after redirect

See original GitHub issue

Library

  • msal@1.x.x or @azure/msal@1.x.x
  • @azure/msal-browser@2.x.x
  • @azure/msal-node@1.x.x
  • @azure/msal-react@1.x.x
  • @azure/msal-angular@0.x.x
  • @azure/msal-angular@1.x.x
  • @azure/msal-angular@2.x.x
  • @azure/msal-angularjs@1.x.x

Description

I have a SPA with msal guards on all routes. After successfully login the user gets redirected to the app, but the ‘code’ stays visible on the url.

image

In the routing root i have:

useHash: false

How can i make sure that '#code=abc...’ gets removed after the redirect? Most example are using hash, so i couldn’t find anything in the samples or docs.

Source

  • Internal (Microsoft)
  • Customer request

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jasonnuttercommented, Apr 26, 2021

Hi @jasonnutter , I got to test the new version, in fact the url is now clean after the redirect, but only if you have the Guard canActivate. My route for example is canLoad and the problem still exists. Thank you!

This is a known limitation (path routing, redirect uri set to page using MSAL Guard via canLoad) that is not supported at this time. Please use a dedicated redirect URI that either does not use the MSAL Guard or uses canActivate.

1reaction
jasonnuttercommented, Apr 21, 2021

We have root caused this issued, and should have a fix in the next version of MSAL Angular v2.

Read more comments on GitHub >

github_iconTop Results From Across the Web

JS redirect/window replace doesn't work if url is the same (but ...
I want to use JS/jQuery to reload the current page and jump to an anchor. ... window.location.href ='currentpage/#msg'+.message_id;. Both change ...
Read more >
Redirection adds '#' to end of URL - Slim Framework
The redirect in this route gets a hash character appended to it. I have added logging immediately before the redirect, and the URL...
Read more >
How to persist URL hash fragments across a login redirect.
By placing an anchor tag somewhere on the page and giving it a name, you could link to that portion of the page...
Read more >
Creating anchor links - Squarespace Help Center
An anchor link (or "page jump") is a special URL that takes you to ... The unique ID becomes part of the URL...
Read more >
How to Code a PHP Redirect - Bluehost.com
Where 'http://www.redirect.to.url.com/' is the URL you wish the users to be redirected to. This can also be a file, like so: <?php header("Location: ......
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