# Get the session token in headers

**URL:** <https://community.dreamfactory.com/t/get-the-session-token-in-headers/2564>\
**Category:** Server-Side Scripting\
**Created:** [April 21, 2016, 9:15pm UTC](https://community.dreamfactory.com/t/get-the-session-token-in-headers/2564 "2016-04-21T21:15:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mathieu\_Gauthier](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/mathieu_gauthier/32/653_2.png) [@Mathieu\_Gauthier](https://community.dreamfactory.com/u/Mathieu_Gauthier)\
**Post date:** [April 21, 2016, 9:15pm UTC](https://community.dreamfactory.com/t/get-the-session-token-in-headers/2564/1 "2016-04-21T21:15:17Z")

</div>

Hi I’m having a hard time trying to get the session token in the header.

Here is what I tried:

var test=event.request.headers.x-dreamfactory-session-token[0]  
throw test

It throws {“error”:{“context”:null,“message”:“Unknown scripting error.”,“code”:500}}

I can get to the host or the dnt but not the session token.

the stringified header json looks like that:

{“host”:[“[dreamfactory.meet3.bitnamiapp.com](http://dreamfactory.meet3.bitnamiapp.com)”],  
“user-agent”:[“Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Firefox/45.0”],“accept”:[“application/json, text/javascript, _/_; q=0.01”],  
“accept-language”:[“en-US,es;q=0.5”],  
“accept-encoding”:[“gzip, deflate”],  
“dnt”:[“1”],  
“content-type”:[“application/json; charset=utf-8”],  
“x-dreamfactory-api-key”:[“45c760eecefccb87319238f07fbe848e488bf46c24caa4b6faf24c2557ab859d  
”],  
“x-dreamfactory-session-token”:[“eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWI  
iOjcsInVzZXJfaWQiOjcsImVtYWlsIjoiZUBhLmNvbSIsImZvcmV2ZXIiOmZhbHNlLCJpc3MiOiJodHRwOlwvXC9kcmVhbWZhY3R  
vcnkubWVldDMuYml0bmFtaWFwcC5jb21cL2FwaVwvdjJcL3VzZXJcL3Nlc3Npb24iLCJpYXQiOjE0NjEyNzM0MDgsImV4cCI6MTQ2MTI3NzAwOCwibmJmIjoxNDYxMjczNDA4LCJqdGkiOiI0MThiZWRiZDMyN2ZiNWI1NzhjNmMyYmI0NTI0YzQxZSJ9  
.XB12WqqqfaXsOzYGiRdoc1pD7nfn2PHUz091BXYHbzg”],  
“content-length”:[“121”],  
“origin”:[“null”],  
“connection”:[“keep-alive”]}

Any idea ?

---

<div class="post-metadata">

**Author:** ![skipatrolmobile](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/skipatrolmobile/32/125_2.png) [@skipatrolmobile](https://community.dreamfactory.com/u/skipatrolmobile)\
**Post date:** [April 21, 2016, 9:48pm UTC](https://community.dreamfactory.com/t/get-the-session-token-in-headers/2564/2 "2016-04-21T21:48:53Z")

</div>

> [@Mathieu\_Gauthier](#):
>
> var test=event.request.headers.x-dreamfactory-session-token[0]

var test=event.request.headers[‘x-dreamfactory-session-token’][0]

---

<div class="post-metadata">

**Author:** ![Mathieu\_Gauthier](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/mathieu_gauthier/32/653_2.png) [@Mathieu\_Gauthier](https://community.dreamfactory.com/u/Mathieu_Gauthier)\
**Post date:** [April 22, 2016, 1:05pm UTC](https://community.dreamfactory.com/t/get-the-session-token-in-headers/2564/3 "2016-04-22T13:05:12Z")

</div>

Thanks so much ! I wish you the greatest skiing.

---

<div class="post-metadata">

**Author:** ![skipatrolmobile](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/skipatrolmobile/32/125_2.png) [@skipatrolmobile](https://community.dreamfactory.com/u/skipatrolmobile)\
**Post date:** [April 22, 2016, 10:22pm UTC](https://community.dreamfactory.com/t/get-the-session-token-in-headers/2564/4 "2016-04-22T22:22:58Z")

</div>

Still a couple more weeks to go with the resort open and then a few more weeks after that with some backcountry spring skiing!

---

<div class="post-metadata">

**Author:** ![Mathieu\_Gauthier](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/mathieu_gauthier/32/653_2.png) [@Mathieu\_Gauthier](https://community.dreamfactory.com/u/Mathieu_Gauthier)\
**Post date:** [May 4, 2016, 6:36pm UTC](https://community.dreamfactory.com/t/get-the-session-token-in-headers/2564/5 "2016-05-04T18:36:17Z")

</div>

you are a lucky one !
