[英]Apollo graphql application cookie not set in browser
I am using apollo graphql on backend side and using cookie authentication method.我在后端使用 apollo graphql 并使用 cookie 身份验证方法。 But when I set cookie on backend side cookie was in Set-Cookie header but doesn't showed in Browser->application ->cookies
但是当我在后端设置 cookie 时,cookie 位于 Set-Cookie header 中,但未显示在 Browser->application ->cookies 中
response.cookie('tokens', token, {
httpOnly: true,
secure: true, //process.env.NODE_ENV === 'production',
sameSite: true,
expires: new Date(Date.now() + 1000 * 60 * 60 * 24),
});
Returned response: Response image返回响应:响应图像
Nothing here.这里没有什么。 Application cookies
申请 cookies
Tried many advices but nothing worked for me.尝试了很多建议,但对我没有任何帮助。
You can set the cookie by您可以通过以下方式设置 cookie
context.setCookies.push({
name: "token",
value: result.token,
options: {
domain:'DOMAIN_NAME',
httpOnly: true,
maxAge: 36000,
secure: 'none',
path: '/',
sameSite:'None'
}
});
by this, I was able to set the cookie and it was set in application folder in developers tool通过这个,我能够设置 cookie,它被设置在开发人员工具的应用程序文件夹中
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.