---
title: "Comment by erdenee on \"JWT and OAuth explained\" | Hashnode"
description: "what happens if refresh token is stolen?"
url: "https://hashnode.com/posts/jwt-and-oauth-explained/676e65e43bb4b435f611e16c/comment/678f7af061e7920fb670efad"
---

[Discussion](https://hashnode.com/posts/jwt-and-oauth-explained/676e65e43bb4b435f611e16c)

Comment [JWT and OAuth explained](https://hashnode.com/posts/jwt-and-oauth-explained/676e65e43bb4b435f611e16c)

[erdenee](https://hashnode.com/@erdenee)

[Jan 21, 2025](https://hashnode.com/posts/jwt-and-oauth-explained/676e65e43bb4b435f611e16c/comment/678f7af061e7920fb670efad)

what happens if refresh token is stolen?

[RAJAT](https://hashnode.com/@0xRajat)

[Jan 28, 2025](https://hashnode.com/posts/jwt-and-oauth-explained/676e65e43bb4b435f611e16c/comment/678f7af061e7920fb670efad#reply-679854c2e732cc8047fc707d)

If refresh token is stolen then the malicious user can access the real user's session (untill it is expired) and may generate a new token. Hackers may use techniques like session hijacking, XSS, or CSRF(cross-site request forgery) to get the token.

http-only cookies allow us to store sensitive data such as refresh tokens, in a way that cannot be accessed by JavaScript. This means that even if there are vulnerabilities in your code or third-party libraries, a hacker won't be able to retrieve the refresh token.
