'Azure AD IsAuthenticated is getting false after copying the home page url in another tab in ReactJs app

I have created an Azure AD authentication in ReactJs application. It is working fine whenever we are logging into it. However, after login and try to copy the home page url in another tab, it is not redirecting to the desired page. I console logged the isAuthenticated, it is showing as false. Home page is the login page actually.

Here is my code snippet of Home page to redirect to the Dashboard :

    useEffect(() => {

        console.log("isAuthenticated", isAuthenticated);
        if(isAuthenticated){
          navigate('dashboard');
        }

  }, [isAuthenticated])

Is there any way out to get isAuthenticated as true in another tab if the user is already logged in.

Thanks...



Solution 1:[1]

As juunas stated in the comment is correct, You might be using sessionStorage that is reason you facing this issue.

In sessionStorage where data is automatically deleted when a browser tab or window is closed, data in local storage has no default expiry. It's only deleted if you manually delete that data from the local storage either directly, via browser settings, or through your JavaScript code.

That means that data in a local storage persists even after a particular tab or browser window is closed

for more information you can refer this Link

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 RahulKumarShaw-MT