gpt4 book ai didi

javascript - 在用户接受 GDPR 和使用 cookie 之前阻止快速 session 设置 session ID

转载 作者:太空宇宙 更新时间:2023-11-04 01:32:10 25 4
gpt4 key购买 nike

出于 GDPR 的原因,我尝试让快速 session 等待,直到用户接受 cookie 的使用,然后再设置 session ID,因为现在 session ID 是立即设置的。

我使用的是 Express、Express Session 和 Passport。

我尝试使用“saveUninitialized”并将其设置为 false 以防止这种情况发生,但没有任何运气..

在 Mac 上运行的一切都是最新的。

我有一个横幅,用户可以在其中接受使用 cookie,并且该横幅设置一个“cookiesAccepted”cookie 来指示我们现在可以使用 cookie,因此我尝试让快速 session 等待该 cookie 存在,或者在用户登录并接受使用 cookie 时手动设置它。

这是用于设置快速 session 的内容

app.use(session({ 
secret: 'secret',
cookie: { maxAge: 24 * 60 * 60 * 1000 }, // 24 hours
resave: true,
saveUninitialized: false,
}));

我还尝试将 resave 设置为 false 等,但似乎无法阻止 cookie 在首次加载时设置..

我只想在用户登录时设置 session ID,使用护照登录功能并防止它在首页加载时自动设置。

我可能漏掉了一些东西

最佳答案

根据我自己的一些研究, session cookie 似乎不受 GDPR 法律同意部分的约束。 This link has a pretty clear explanation of exemptions :

Exemptions to the consent requirement

Some cookies are exempt from the consent requirement and therefore are not subject to preventive blocking (though you’re still required to inform users about your use of cookies – see caution box below). The exemptions are as follows:

  • Technical cookies strictly necessary for the provision of the service. These include preference cookies, session cookies, load balancing, etc.

  • Statistical cookies managed directly by you (not third-parties), providing that the data is not used for profiling*

  • Anonymized statistical third-party cookies (e.g. Google Analytics)*

* This exemption is may not be applicable for all regions and is therefore subject to specific local regulations.

也就是说,您仍然需要告知用户您正在使用 cookie。只要用户可以从网站上的任何位置清晰、轻松地访问该信息,您网站上的横幅或指向 Cookie 政策的链接就可以发挥作用。

关于javascript - 在用户接受 GDPR 和使用 cookie 之前阻止快速 session 设置 session ID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55741292/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com