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

Looping occurs on Reload - dotnet-core-b2c-embedded #73

Open
iamweaselworf opened this issue Jun 16, 2022 · 0 comments
Open

Looping occurs on Reload - dotnet-core-b2c-embedded #73

iamweaselworf opened this issue Jun 16, 2022 · 0 comments

Comments

@iamweaselworf
Copy link

When I try to implement the dotnet-core-b2c-embedded in my own environment [pre-reqs are covered] looping occurs on due to the JavaScript reload. Every sample I have tried does this. I fixed this by changing the reload JS to this:

<script> var refresh = window.sessionStorage.getItem('refresh'); console.log(refresh); if(document.referrer.startsWith('https://login.arctoso.com/') && (refresh === null)) { window.sessionStorage.setItem('refresh', "1"); window.top.location.reload(); }; </script>

This prevents the looping, but the base site did not get the token, even though it was clearly reloaded. What the reload should do is force the site to detect that there was an authentication event, and consume the token. I fixed this by changing the script logic to:

<script> var refresh = window.sessionStorage.getItem('refresh'); console.log(refresh); if(document.referrer.startsWith('https://login.arctoso.com/') && (refresh === null)) { window.sessionStorage.setItem('refresh', "1"); window.top.location = "https://localhost:44316/MicrosoftIdentity/Account/SignIn" }; </script>

This now works, but what is the underlying issue on all of these samples? Did something change in browser behaviors? I tested to verify looping also by publishing the solution to an Azure app instance and used the same custom domain root to ensure the issue wasn't caused by some type domain security issue.

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

No branches or pull requests

1 participant