# Storing a response to a variable

**URL:** <https://discourse.nodered.org/t/storing-a-response-to-a-variable/52317>\
**Category:** Developing Nodes\
**Created:** [17 October 2021 09:21 UTC](https://discourse.nodered.org/t/storing-a-response-to-a-variable/52317 "2021-10-17T09:21:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bos1982](https://avatars.discourse-cdn.com/v4/letter/b/ac8455/32.png) [@Bos1982](https://discourse.nodered.org/u/Bos1982)\
**Post date:** [17 October 2021 09:21 UTC](https://discourse.nodered.org/t/storing-a-response-to-a-variable/52317/1 "2021-10-17T09:21:58Z")

</div>

Hi,

I am working on something but it seems a little bit too difficult for me....

For the use of an API you first need to send a bearer token message, to receive a new one which is valid for only 24 hours.  
I know how to send the first one. When I receive the request, how can I catch the bearer token and use it as a variable (?) for the second request?

```auto
https://m.auroravision.net/token/v1/devices/token?auds=inv,ess

```

(bearer token)

response:

```auto
{"auds":"inv,ess","exp":"2021-10-18T08:48:50+00:00","token":"eyJ0e-etcetcetc"}

```

store response "token" into:

```auto
https://m.auroravision.net/ums/v1/users/"user.name"/token?auds=ess,inv

```

(send response to http request 1 "token" as bearer token in 2nd message)

The second call needs to be send approximetaly every 24 hours.

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [17 October 2021 10:35 UTC](https://discourse.nodered.org/t/storing-a-response-to-a-variable/52317/2 "2021-10-17T10:35:12Z")

</div>

In the documentation you can find [details about using context](https://nodered.org/docs/user-guide/context) (to store variables for later use)

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [17 October 2021 11:04 UTC](https://discourse.nodered.org/t/storing-a-response-to-a-variable/52317/3 "2021-10-17T11:04:00Z")

</div>

Is this really about creating a custom node? If not, could you please change the category to "General"? Thanks.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [16 December 2021 11:04 UTC](https://discourse.nodered.org/t/storing-a-response-to-a-variable/52317/4 "2021-12-16T11:04:50Z")

</div>

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