-
Notifications
You must be signed in to change notification settings - Fork 73
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
Stuck with auth.isLoading = true with previous page action #1243
Comments
Hello, useEffect(() => {
/* react-oidc is stuck in isLoading mode when we trigger login process so we need to reload the Login page if user press the back button */
const reloadIfPrevious = () => {
const perfEntry = performance.getEntriesByType('navigation')[0] as PerformanceNavigationTiming
if (perfEntry.type === 'back_forward') {
location.reload()
}
}
window.addEventListener('pageshow', reloadIfPrevious)
return () => {
window.removeEventListener('pageshow', reloadIfPrevious)
}
}) |
I guess the problem comes from here: react-oidc-context/src/AuthProvider.tsx Lines 204 to 215 in 0eb57ac
When you click back on your IdP login page, you will not hit the PS: The |
Not able to reproduce here. I tried to reproduce with the IdP Also notice I have setup due to other reasons a no-caching on my |
Indeed, with CacheControl set to no-cache, my app reloads no matter what. This is another workaround. |
Hello! |
I am not planing to fix this. Also i have not an idea of how i could tackle this nicely without adding hack code... Have you tried the |
Hi, @pamapa ! Thank you for your quick response. I'm going to try this. Is it a correct value? UPD: just tried to do it, this does not help |
On the other hand the following code should reset the state on a re-render: react-oidc-context/src/AuthProvider.tsx Lines 231 to 255 in 0eb57ac
@AnzhelikaKotko Why is Line 241 A complete other approach: |
Hello @pamapa ! Sorry for the long response. I've tried to use redirectMethod with replace, but it's not convenient for my apps, the flow is changed for all browsers in this case. What you think about this workaround? #1243 (comment) Thank you! UPDATED |
Hello! I found a solution for IOS browsers. I'll leave it here just in case someone catches the same
and some useful information could be found here https://web.dev/articles/bfcache Also want to add, that in my case it's not a bug of react-oidc-contex but specific caching behaviour of ios browsers |
It seems to be bigger issue, because for me it also does not work on Windows - Firefox & Edge. So it seems to be library issue not browsers. Steps to reproduce:
That's my code (from official docs example):
Properties of auth on which browser stuck after going back: Firefox Version: 129.0 (64 bits) |
As mentioned here, I can only reproduce this when removing the I know various project setups exist. But for reference, we bundle our React apps with Vite, then serve the static assets with Express. Then we set the |
Hello,
I have a page with several elements and a button that does this action.
When I click this button, I am redirected to Keycloak to log in. But when I do "Back" with the browser, I'm stuck on my redirect display in my app because auth.isLoading=true and auth.activeNavigator="signinRedirect". I have experienced this problem with Firefox and Edge.
Here is my App.tsx file
There is a way to fix it and display my initial page with my button ?
Config :
The text was updated successfully, but these errors were encountered: