English 中文(简体)
co子-占有权: 占有权为无效,但不能从浏览器中清除 co。
原标题:cookie-session: req.session is null but cookies are not removed from browser

http://www.npmjs.com/ Package/cookie-session#destroying-a-session”rel=“nofollow noreferer” 可在<条码>reqsession = 无上删除会议。

在我的“ Nest”申请中,我开了会(利用会议评分),并向它分配了<条码>用户Id的财产。

  @Post( /signin )
  @Serialize(UserDto)
  async signin(@Body() body: SigninUserDto, @Session() session: any) {
    const user = await this.authService.signin(body);
    session.userId = user.id;
    return user;
  } 

This creates a session in the browser: enter image description here

在签署时,我确定会议按文件规定为无效,在浏览器中,会议座标仍然显而易见。 为什么没有删除;这是否引起安全关切;如果会议是安全问题,如何取消?

  @Post( /signout )
  @UseGuards(AuthGuard)
  @Serialize(UserDto)
  signout(@Session() session: any) {
    session = null;
  }

Edit: 一些额外的Info——在前端,我使用“The NextJS”建立了一种基本标识,将用户转移到一个有简单标识的 but子的主页。 沉积 but子在分配<代码>session=null的 NestJS申请中向信号终点发出一pi。

问题回答

你们是否检查了厨师的内容? Probable session = 无 摘自厨师的一些会议数据,留下的只是空白的厨师。

如果没有:

您可尝试使用@Req() req: Request,然后打电话req.session = 无





相关问题
how to have http response with pipe throwing error?

I have a nestjs application in which I created a pipe to check if value is a valid URL. If the URL is invalid, throw error. This is used in a controller to save an item into the database. I just ...

Can t set cookie in response NestJs

I Have a nestjs graphQL auth microservice and trying to set a http only cookie containing the token, and for some reason setting the cookie doesn t work, i get this error: { "errors": [ ...

store data in memory with nestjs

I am trying to persist some data in my nestjs server so I can then use that data in my client app through http requests. I have created a products.service.ts file with the function getAllData() that ...

NestJS ConfigModule not loading the correct .env file

I have 2 different file with environment variables: .env.development and .env.production. I am trying to load the correct file through the ConfigModule like so: app.module.ts @Module({ imports: [ ...

热门标签