Azure AD ISAUTHENTICATITATED在ReactJS应用程序中的另一个选项卡中复制主页URL后会变得错误。
我在ReactJS应用程序中创建了Azure AD身份验证。每当我们登录它时,它都可以正常工作。但是,登录并尝试在另一个选项卡中复制主页URL后,它并未将其重定向到所需的页面。我委托记录了术语化的,它显示为假。主页实际上是登录页面。
这是我的主页代码段,以重定向到仪表板:
useEffect(() => {
console.log("isAuthenticated", isAuthenticated);
if(isAuthenticated){
navigate('dashboard');
}
}, [isAuthenticated])
是否有任何办法在另一个选项卡中以符号为true。
如果用户已经登录,
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...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如
JUUNAS
在评论中所述的正确,您可能正在使用sessionstorage
,这是您遇到此问题的原因。在
sessionStorage
关闭浏览器选项卡或窗口时自动删除数据的其中,本地存储中的数据没有默认到期。仅当您直接通过浏览器设置或通过JavaScript代码直接从本地存储中删除该数据时才删除。这意味着即使在关闭特定选项卡或浏览器窗口之后,本地存储中的数据仍然存在,
以获取更多信息,您可以参考此 link
As
juunas
stated in the comment is correct, You might be usingsessionStorage
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