DenzelCode / nest-auth

NestJS authentication with MongoDB, WebSocket and JWT (Login, Register, Google Login, Facebook Login, Apple Login, Messages, Rooms, Private DMs)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

What is the purpose of random sessionToken in the User entity?

YogeshUmeshVaity opened this issue · comments

Hi, you have done a great job with this project! I was just going through the code and was wondering what must be the purpose of sessionToken in the User entity. Do you mind explaining it a bit? It looks like it is a random string concantenated to the secret while generating the refreshToken and accessToken. What if we don't use it?

Thank you very much!

The purpose of the sessionToken is when you are logged in on different devices and you change your password it gives you the option to log out from all your other devices, if you want to sign off from all of the other devices, it changes your session token.

async logoutFromAllDevices(@CurrentUser() user: User) {

image

@YogeshUmeshVaity You are welcome.