# Using same Auth Token for multiple executions

**URL:** <https://community.n8n.io/t/using-same-auth-token-for-multiple-executions/43636>\
**Category:** Questions\
**Tags:** credentials, node, workflow-building, http-request\
**Created:** [April 2, 2024, 11:01am UTC](https://community.n8n.io/t/using-same-auth-token-for-multiple-executions/43636 "2024-04-02T11:01:48Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gabriele\_Bracciali](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/gabriele_bracciali/32/31293_2.png) [@Gabriele\_Bracciali](https://community.n8n.io/u/Gabriele_Bracciali)\
**Post date:** [April 2, 2024, 11:01am UTC](https://community.n8n.io/t/using-same-auth-token-for-multiple-executions/43636/1 "2024-04-02T11:01:48Z")

</div>

**Hi everyone!**

## Describe the problem/error/question

I am receiving a webhook event from a external web service, once arrived, I have to make a new HTTP request for obtain more info, for doing that, I have to request a Auth Token that can be used for the request.  
The token is available for 30 minutes, but so far I am using a new token for each new request/webhook event.  
I would like to find a way to use the same token for all the request within the 30 minutes of validity.

Have you ever had a similar use case? My first idea is to use an external db as Gsheet, but need to understand how to manage the 30 minutes time.

## Share the output returned by the last node

## Information on your n8n setup

- **n8n version:** 0.234
- **Database (default: SQLite):**
- **n8n EXECUTIONS\_PROCESS setting (default: own, main):**
- **Running n8n via (Docker, npm, n8n cloud, desktop app):** self-hosted
- **Operating system:** mac

---

<div class="post-metadata">

**Author:** ![barn4k](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/barn4k/32/8170_2.png) [@barn4k](https://community.n8n.io/u/barn4k)\
**Post date:** [April 2, 2024, 7:03pm UTC](https://community.n8n.io/t/using-same-auth-token-for-multiple-executions/43636/2 "2024-04-02T19:03:29Z")

</div>

hello @Gabriele_Bracciali

According to the OAuth 2.0 standard, you should not rely on the token lifetime. Instead, your workflow should handle the 401 Error itself (if it occurs \>\> request new token).  
As to the sharing, you can save it locally in a file or in the WorkflowStaticData (if it will be reused in the same workflow).

---

<div class="post-metadata">

**Author:** ![Gabriele\_Bracciali](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/gabriele_bracciali/32/31293_2.png) [@Gabriele\_Bracciali](https://community.n8n.io/u/Gabriele_Bracciali)\
**Post date:** [April 3, 2024, 9:44am UTC](https://community.n8n.io/t/using-same-auth-token-for-multiple-executions/43636/3 "2024-04-03T09:44:33Z")

</div>

Hi @barn4k Thanks for replying me!  
How “WorkflowStaticData” works and how should I use for this use case?

---

<div class="post-metadata">

**Author:** ![barn4k](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/barn4k/32/8170_2.png) [@barn4k](https://community.n8n.io/u/barn4k)\
**Post date:** [April 3, 2024, 1:19pm UTC](https://community.n8n.io/t/using-same-auth-token-for-multiple-executions/43636/4 "2024-04-03T13:19:42Z")

</div>

You can use it in the **Code** node  
[getWorkflowStaticData | n8n Docs](https://docs.n8n.io/code/cookbook/builtin/get-workflow-static-data/)

---

<div class="post-metadata">

**Author:** ![Gabriele\_Bracciali](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/gabriele_bracciali/32/31293_2.png) [@Gabriele\_Bracciali](https://community.n8n.io/u/Gabriele_Bracciali)\
**Post date:** [April 4, 2024, 8:51am UTC](https://community.n8n.io/t/using-same-auth-token-for-multiple-executions/43636/5 "2024-04-04T08:51:38Z")

</div>

UPDATE:  
I’ve found a way to create a file in the Disk and then Read it using the Command Line:

This one is the example:

So basically the process should be:  
Read the token already saved on the disk, use it for the HTTP request, then check if there is an error,  
If yes: I will generate new token, save it in the disk in the same file, and run the request again,  
If no: Continue the process

---

<div class="post-metadata">

**Author:** ![barn4k](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/barn4k/32/8170_2.png) [@barn4k](https://community.n8n.io/u/barn4k)\
**Post date:** [April 4, 2024, 9:26am UTC](https://community.n8n.io/t/using-same-auth-token-for-multiple-executions/43636/6 "2024-04-04T09:26:34Z")

</div>

yes, but you should check for the error number in the error output of the node, not in the regular output (it won’t work there)

 ![image](https://europe1.discourse-cdn.com/n8n/original/3X/d/8/d8c503b9fd71668d3804fcc7e3565f942b7856d2.png)

---

<div class="post-metadata">

**Author:** ![Gabriele\_Bracciali](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/gabriele_bracciali/32/31293_2.png) [@Gabriele\_Bracciali](https://community.n8n.io/u/Gabriele_Bracciali)\
**Post date:** [April 5, 2024, 9:19am UTC](https://community.n8n.io/t/using-same-auth-token-for-multiple-executions/43636/7 "2024-04-05T09:19:56Z")

</div>

hi @barn4k , yes good point, I was using an old version of n8n and there was not this option.  
Thank you so much!

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/system/32/195824_2.png) [@system](https://community.n8n.io/u/system)\
**Post date:** [April 12, 2024, 9:20am UTC](https://community.n8n.io/t/using-same-auth-token-for-multiple-executions/43636/8 "2024-04-12T09:20:17Z")

</div>

Closed on April 12, 2024, 9:20am UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
