# How to Run a Schedule(Timer) Script at the Client Session – For Token Refresh in Perspective

**URL:** <https://forum.inductiveautomation.com/t/how-to-run-a-schedule-timer-script-at-the-client-session-for-token-refresh-in-perspective/111691>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [October 24, 2025, 1:40am UTC](https://forum.inductiveautomation.com/t/how-to-run-a-schedule-timer-script-at-the-client-session-for-token-refresh-in-perspective/111691 "2025-10-24T01:40:47Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eric\_Huang](https://avatars.discourse-cdn.com/v4/letter/e/3be4f8/32.png) [@Eric\_Huang](https://forum.inductiveautomation.com/u/Eric_Huang)\
**Post date:** [October 24, 2025, 1:40am UTC](https://forum.inductiveautomation.com/t/how-to-run-a-schedule-timer-script-at-the-client-session-for-token-refresh-in-perspective/111691/1 "2025-10-24T01:40:47Z")

</div>

Hello everyone,

I'm working on a Perspective application using Ignition 8.3. My requirement is to periodically refresh the authentication token (Through AWS Cognito) for each user. This task needs to be executed on a fixed time interval (e.g., every 5 minutes) and must run independently within the context of each active Perspective client session.

This ensures that the unique token for that user remains valid without relying on a global Gateway script.

My questions is: What is the recommended method and where for running a script periodically that is scoped specifically to the client session?

Thank you in advance for your guidance!

---

<div class="post-metadata">

**Author:** ![diamond](https://avatars.discourse-cdn.com/v4/letter/d/e79b87/32.png) [@diamond](https://forum.inductiveautomation.com/u/diamond)\
**Post date:** [October 24, 2025, 6:11am UTC](https://forum.inductiveautomation.com/t/how-to-run-a-schedule-timer-script-at-the-client-session-for-token-refresh-in-perspective/111691/2 "2025-10-24T06:11:16Z")

</div>

Are you sure you need different tokens for each client?

---

<div class="post-metadata">

**Author:** ![David\_Stone](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/david_stone/32/79749_2.png) [@David\_Stone](https://forum.inductiveautomation.com/u/David_Stone)\
**Post date:** [October 24, 2025, 8:37am UTC](https://forum.inductiveautomation.com/t/how-to-run-a-schedule-timer-script-at-the-client-session-for-token-refresh-in-perspective/111691/3 "2025-10-24T08:37:02Z")

</div>

All scripts in perspective run on the gateway, so all requests will come from the gateway, not the session. You could attach context to the requests and have individual tokens, but you're better off just using one token for the gateway and refreshing it only for the gateway.

---

<div class="post-metadata">

**Author:** ![Eric\_Huang](https://avatars.discourse-cdn.com/v4/letter/e/3be4f8/32.png) [@Eric\_Huang](https://forum.inductiveautomation.com/u/Eric_Huang)\
**Post date:** [October 24, 2025, 5:57pm UTC](https://forum.inductiveautomation.com/t/how-to-run-a-schedule-timer-script-at-the-client-session-for-token-refresh-in-perspective/111691/4 "2025-10-24T17:57:19Z")

</div>

Yes. In our case, each Perspective session represents an individual user logging in with their own Cognito user account.

---

<div class="post-metadata">

**Author:** ![Eric\_Huang](https://avatars.discourse-cdn.com/v4/letter/e/3be4f8/32.png) [@Eric\_Huang](https://forum.inductiveautomation.com/u/Eric_Huang)\
**Post date:** [October 24, 2025, 6:02pm UTC](https://forum.inductiveautomation.com/t/how-to-run-a-schedule-timer-script-at-the-client-session-for-token-refresh-in-perspective/111691/5 "2025-10-24T18:02:34Z")

</div>

That’s a good point. And yes, I understand that all Perspective scripts actually execute on the Gateway.

In our case though, each user logs in through Cognito with their own credentials, and the access token is used to identify and authorize that individual when calling our backend APIs.

So we do need to maintain per-session tokens,and it just needs to store and update the tokens separately for each Perspective session.

---

<div class="post-metadata">

**Author:** ![David\_Stone](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/david_stone/32/79749_2.png) [@David\_Stone](https://forum.inductiveautomation.com/u/David_Stone)\
**Post date:** [October 24, 2025, 7:18pm UTC](https://forum.inductiveautomation.com/t/how-to-run-a-schedule-timer-script-at-the-client-session-for-token-refresh-in-perspective/111691/6 "2025-10-24T19:18:06Z")

</div>

Store the token in the session props, pass it to the gateway on demand with message handlers.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [October 26, 2025, 7:18am UTC](https://forum.inductiveautomation.com/t/how-to-run-a-schedule-timer-script-at-the-client-session-for-token-refresh-in-perspective/111691/7 "2025-10-26T07:18:54Z")

</div>

And make sure to set the access of that prop to private.

---

<div class="post-metadata">

**Author:** ![Arnaud\_Declerck](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/arnaud_declerck/32/44872_2.png) [@Arnaud\_Declerck](https://forum.inductiveautomation.com/u/Arnaud_Declerck)\
**Post date:** [June 15, 2026, 9:06am UTC](https://forum.inductiveautomation.com/t/how-to-run-a-schedule-timer-script-at-the-client-session-for-token-refresh-in-perspective/111691/8 "2026-06-15T09:06:05Z")

</div>

Hi @Eric_Huang ,

I'm in the same case, could you share how you implemented this?

If you prefer not that's fine or you can do it in private.

Thanks you

Arnaud
