# Pass an Access Token to a Function Node

**URL:** <https://discourse.nodered.org/t/pass-an-access-token-to-a-function-node/64391>\
**Category:** General\
**Tags:** http-request, function-node\
**Created:** [26 June 2022 12:42 UTC](https://discourse.nodered.org/t/pass-an-access-token-to-a-function-node/64391 "2022-06-26T12:42:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![zouhir](https://avatars.discourse-cdn.com/v4/letter/z/4af34b/32.png) [@zouhir](https://discourse.nodered.org/u/zouhir)\
**Post date:** [26 June 2022 12:42 UTC](https://discourse.nodered.org/t/pass-an-access-token-to-a-function-node/64391/1 "2022-06-26T12:42:04Z")

</div>

Hi, I hope this finds you well.  
I'm GETTING an Access Token by calling a RestAPI through an HTTP request, then I'm extracting that Access Token to a msg.payload, I'd like to know how I can pass that Bearer Token to a Function Node.  
See below screenshot.  
 ![Function Node](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/f/6f2b2b1c53ce468af52b7d28cd8cfb33443db776.png)

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [26 June 2022 13:18 UTC](https://discourse.nodered.org/t/pass-an-access-token-to-a-function-node/64391/2 "2022-06-26T13:18:14Z")

</div>

You can concatenate strings and variables using The `+` operator  
e.g.

```auto
{
    "Content-Type": "application/json",
    "authorization": "Bearer " + msg.payload
}

```

> **[Expressions and operators - JavaScript | MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators#string_operators)**
>
> This chapter describes JavaScript's expressions and operators, including assignment, comparison, arithmetic, bitwise, logical, string, ternary and more.

---

<div class="post-metadata">

**Author:** ![zouhir](https://avatars.discourse-cdn.com/v4/letter/z/4af34b/32.png) [@zouhir](https://discourse.nodered.org/u/zouhir)\
**Post date:** [27 June 2022 05:29 UTC](https://discourse.nodered.org/t/pass-an-access-token-to-a-function-node/64391/3 "2022-06-27T05:29:27Z")

</div>

Seems to work, thanks a lot !

---

<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:** [26 August 2022 05:29 UTC](https://discourse.nodered.org/t/pass-an-access-token-to-a-function-node/64391/4 "2022-08-26T05:29:43Z")

</div>

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