u/ilovefunctionsin r/node • Recommends
On “Securing Refresh tokens”
> I was thinking of a scenario, where if both my access and refreshTokens are stolen, what can be done in that case.?
You want to use "rotating refresh tokens" - essentially, this is when a new refresh token is generated each time the older one is used. Checkout this video: link to this video
> Is there any way to recognize that a user has signed in from a different device?
Yea... you issue one set of access / refresh tokens per device and you store that info somehow in your db. If a user has multiple such sets, they have logged into multiple devices.
> We usually see mails when there is a new sign in to say google, or FB, but how can it be achieved on a very high level in node?
You keep track of…