# Show Popup/Alert Before Logging Out With GetAccesTokenSilently

**URL:** <https://community.auth0.com/t/show-popup-alert-before-logging-out-with-getaccestokensilently/93619>\
**Category:** Get Help\
**Tags:** jwt, react, access-token, auth0\
**Created:** [November 3, 2022, 8:07am UTC](https://community.auth0.com/t/show-popup-alert-before-logging-out-with-getaccestokensilently/93619 "2022-11-03T08:07:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ritiwari369](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ritiwari369/32/36504_2.png) [@ritiwari369](https://community.auth0.com/u/ritiwari369)\
**Post date:** [November 3, 2022, 8:07am UTC](https://community.auth0.com/t/show-popup-alert-before-logging-out-with-getaccestokensilently/93619/1 "2022-11-03T08:07:17Z")

</div>

Hi

SDK:- Latest REACT Auth0 SDK

In react, I’m storing access token in cookie. I want to update access token (grant\_type  
: “refresh\_token”) after its expiry using getAccessTokenSilently.

And setup works fine until absolute lifetime of refresh token (refresh token rotation is enabled).

Once absolute lifetime of refresh token is over, getAccessTokenSilently logs out of application automatically.

But I want to show alert or warning before logging out user. How can I do that?

@dan.woda @lihua.zhang or anyone please help with it…

Regards  
Rishi Tiwari

---

<div class="post-metadata">

**Author:** ![ritiwari369](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ritiwari369/32/36504_2.png) [@ritiwari369](https://community.auth0.com/u/ritiwari369)\
**Post date:** [November 3, 2022, 8:07am UTC](https://community.auth0.com/t/show-popup-alert-before-logging-out-with-getaccestokensilently/93619/2 "2022-11-03T08:07:43Z")

</div>

I’m using setup similer to this:- [Implementing AutoLogout Feature in Web Applications (React-JS) - DEV Community 👩‍💻👨‍💻](https://dev.to/olumidesamuel_/implementing-autologout-feature-in-web-applications-react-js-28k5)

---

<div class="post-metadata">

**Author:** ![ritiwari369](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ritiwari369/32/36504_2.png) [@ritiwari369](https://community.auth0.com/u/ritiwari369)\
**Post date:** [November 3, 2022, 9:41am UTC](https://community.auth0.com/t/show-popup-alert-before-logging-out-with-getaccestokensilently/93619/3 "2022-11-03T09:41:08Z")

</div>

Got the solution from another thread [Check session without extending it](https://community.auth0.com/t/check-session-without-extending-it/58569). We can do like this:-

```auto
getAccessTokenSilently()
      .then((token) => {
        console.log(token);
      })
      .catch((e) => {
        if (e.error === "login_required")
          alert("logging out");
      });

```

Thanks 🙂

---

<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:** [November 3, 2022, 12:12pm UTC](https://community.auth0.com/t/show-popup-alert-before-logging-out-with-getaccestokensilently/93619/4 "2022-11-03T12:12:54Z")

</div>

Thanks for sharing it with the rest of community!

---

<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:** [November 4, 2022, 1:01pm UTC](https://community.auth0.com/t/show-popup-alert-before-logging-out-with-getaccestokensilently/93619/5 "2022-11-04T13:01:50Z")

</div>


