# Set access token in request header

**URL:** <https://forum.flowable.org/t/set-access-token-in-request-header/5244>\
**Category:** Uncategorized\
**Created:** [January 15, 2020, 11:10am UTC](https://forum.flowable.org/t/set-access-token-in-request-header/5244 "2020-01-15T11:10:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![prs.parisa](https://avatars.discourse-cdn.com/v4/letter/p/5e9695/32.png) [@prs.parisa](https://forum.flowable.org/u/prs.parisa)\
**Post date:** [January 15, 2020, 11:10am UTC](https://forum.flowable.org/t/set-access-token-in-request-header/5244/1 "2020-01-15T11:10:01Z")

</div>

Hi

I am trying to use http task. I want to send an Http request with an access token:

```
<serviceTask id="httpGet" name="HTTP Get" flowable:type="http">
  <extensionElements>
    <flowable:field name="requestMethod">
      <flowable:string><![CDATA[GET]]></flowable:string>
    </flowable:field>
    <flowable:field name="requestUrl">
      <flowable:string><![CDATA[http://localhost/api/v2/users]]></flowable:string>
    </flowable:field>
    <flowable:field name="requestHeaders">
      <flowable:expression><![CDATA[${headers}]]></flowable:expression>
    </flowable:field>
  </extensionElements>
</serviceTask>

```

I want to set an access token in headers:

```
   Map<String, Object> variables = new HashMap<>();
    variables.put("headers", "Authorization: Bearer 0d65dbfa-73y6-41y7-8eaa-29c4e3973f46");
    String procId = runtimeService.startProcessInstanceByKey("simpleGetOnly").getId();
    List<HistoricVariableInstance> variables2 = 
   historyService.createHistoricVariableInstanceQuery().processInstanceId(procId).list();

```

but it does not work.

```
org.flowable.common.engine.api.FlowableException: Unknown property used in expression: ${headers}

```

what is wrong in my code? how should I send access token in my http request?

---

<div class="post-metadata">

**Author:** ![joram](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/joram/32/26_2.png) [@joram](https://forum.flowable.org/u/joram)\
**Post date:** [January 17, 2020, 3:29pm UTC](https://forum.flowable.org/t/set-access-token-in-request-header/5244/2 "2020-01-17T15:29:42Z")

</div>

You’re not passing the variables map to the startProcessInstanceByKey method.

---

<div class="post-metadata">

**Author:** ![prs.parisa](https://avatars.discourse-cdn.com/v4/letter/p/5e9695/32.png) [@prs.parisa](https://forum.flowable.org/u/prs.parisa)\
**Post date:** [January 18, 2020, 6:21am UTC](https://forum.flowable.org/t/set-access-token-in-request-header/5244/5 "2020-01-18T06:21:19Z")

</div>

thank you.

it works 🙂

---

<div class="post-metadata">

**Author:** ![prs.parisa](https://avatars.discourse-cdn.com/v4/letter/p/5e9695/32.png) [@prs.parisa](https://forum.flowable.org/u/prs.parisa)\
**Post date:** [June 27, 2020, 9:11am UTC](https://forum.flowable.org/t/set-access-token-in-request-header/5244/6 "2020-06-27T09:11:38Z")

</div>

Is there any feature in flowable for oauth2? for calling http services in a http task?
