Directus在管理应用程序源上设置cookie,但我在前端应用程序上需要它

问题描述 投票:1回答:1

我在localhost上有directus API和管理应用程序,在localhost:3000上有前端React应用程序。当我尝试通过React接口中的client.login方法登录时,directus将cookie设置为localhost(其管理应用程序源)。但是我需要在我的实际应用程序所在的localhost:3000上使用此cookie。设置cookie标头是这样的:directus-test-session = 4JCvIJhNxCovLAvCwkSulylc8ZYq1iok4EQ3%3A%3A5b84ad5310ba25a7129ed57448136e13;路径= /; expires =星期六,2020年1月4日14:06:49 UTC; HttpOnly

Google控制台也提供如下警告:设置了与http://directus.test处的跨站点资源关联的cookie,而没有SameSite属性。如果将来的Chrome浏览器版本将Cookie设置为SameSite=NoneSecure,则仅会发送带有跨站点请求的Cookie。

我需要将cookie设置为localhost:3000。我怎样才能做到这一点?预先谢谢你。

我在localhost上有directus API和管理应用程序,在localhost:3000上有前端React应用程序。当我尝试通过React接口中的client.login方法登录时,directus将cookie设置为localhost(其...

cookies localhost setcookie directus
1个回答
0
投票

我不确定Chrome是否允许您在撰写本文时将Cookie设置为特定端口上的localhost *

© www.soinside.com 2019 - 2024. All rights reserved.