# Securing Single Page Applications with Refresh Token Rotation

**URL:** <https://community.auth0.com/t/securing-single-page-applications-with-refresh-token-rotation/41119>\
**Category:** Blog Discussions\
**Created:** [April 15, 2020, 3:42pm UTC](https://community.auth0.com/t/securing-single-page-applications-with-refresh-token-rotation/41119 "2020-04-15T15:42:52Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![bachi.degli-innocent](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/bachi.degli-innocent/32/16949_2.png) [@bachi.degli-innocent](https://community.auth0.com/u/bachi.degli-innocent)\
**Post date:** [April 15, 2020, 3:42pm UTC](https://community.auth0.com/t/securing-single-page-applications-with-refresh-token-rotation/41119/1 "2020-04-15T15:42:52Z")

</div>

How Auth0 helps you securely maintain user sessions and engagement in the era of ITP

Brought to you by @randynasson

[Read on](https://auth0.com/blog/securing-single-page-applications-with-refresh-token-rotation/)

 ![Securing Single Page Applications with Refresh Token Rotation](https://global.discourse-cdn.com/auth0/original/3X/9/a/9a72f7e9a1d260899810d4a4d64a28e762c821b3.jpeg)

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [April 15, 2020, 3:44pm UTC](https://community.auth0.com/t/securing-single-page-applications-with-refresh-token-rotation/41119/2 "2020-04-15T15:44:12Z")

</div>

If you want to see a few more details regarding that here’s the community announcement for that feature:

> [@We've added support for Refresh Token Rotation!](http://community.auth0.com/t/weve-added-support-for-refresh-token-rotation/41107):
>
> Support for Refresh Token Rotation! Auth0 is proud to announce that as of today, Refresh Token Rotation with Reuse Detection is available for all public cloud customers. Refresh Token Rotation provides a secure method for using refresh tokens in SPAs while providing end-users with seamless access to resources without the disruption in UX caused by browser privacy technology like ITP. With Refresh Token Rotation enabled, every time a client exchanges an RT to get a new AT, a new RT is also retu…

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [December 10, 2021, 8:51am UTC](https://community.auth0.com/t/securing-single-page-applications-with-refresh-token-rotation/41119/3 "2021-12-10T08:51:26Z")

</div>



---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [March 7, 2022, 1:58pm UTC](https://community.auth0.com/t/securing-single-page-applications-with-refresh-token-rotation/41119/4 "2022-03-07T13:58:40Z")

</div>



---

<div class="post-metadata">

**Author:** ![y.snaky](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/y.snaky/32/40827_2.png) [@y.snaky](https://community.auth0.com/u/y.snaky)\
**Post date:** [October 26, 2022, 8:33am UTC](https://community.auth0.com/t/securing-single-page-applications-with-refresh-token-rotation/41119/5 "2022-10-26T08:33:34Z")

</div>

I still didn’t get one point though. What if the refresh token is stolen but there was not re-use in place?

1. Legit user (U1) gets AT1 and RT1 for the first time.
2. Malicious user (U2) steels RT1.
3. U1 closes the browser while AT1 is still valid.
4. U2 uses RT1 to get AT2 and RT2
5. U2 is free to continue forever until U1 logs in again.

---

<div class="post-metadata">

**Author:** ![james\_fremen](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/james_fremen/32/56401_2.png) [@james\_fremen](https://community.auth0.com/u/james_fremen)\
**Post date:** [April 15, 2024, 6:27am UTC](https://community.auth0.com/t/securing-single-page-applications-with-refresh-token-rotation/41119/6 "2024-04-15T06:27:56Z")

</div>

There appear to be some [serious reservations about this approach raised later by Ping](https://www.pingidentity.com/en/resources/blog/post/refresh-token-rotation-spa.html) (I am not affiliated with Ping). TLDR the SPA remains vulnerable to ever-evolving exploits which can allow black hats to make use of client-side tokens regardless of refresh token rotation. A sensitive app, perhaps handling personal data or financial transactions, might want to consider using Auth0’s token rotation (which is quite handy IMHO) in a backend service rather than in the SPA.

---

<div class="post-metadata">

**Author:** ![james\_fremen](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/james_fremen/32/56401_2.png) [@james\_fremen](https://community.auth0.com/u/james_fremen)\
**Post date:** [April 15, 2024, 6:58am UTC](https://community.auth0.com/t/securing-single-page-applications-with-refresh-token-rotation/41119/7 "2024-04-15T06:58:55Z")

</div>

This post shows up first in my search engine, but a little digging for the Backend for Frontend pattern finds a [later post from Auth0](https://auth0.com/blog/backend-for-frontend-pattern-with-auth0-and-dotnet/) for React SPAs. It does not explicitly mention Auth0’s refresh token rotation, but it seems like it might be appropriate. It would be nice if articles could reflect changes in recommended security practices. Perhaps BFF is no longer considered best practice…
