Get the session token in headers

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”],
“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 ?

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

1 Like

Thanks so much ! I wish you the greatest skiing.

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

you are a lucky one !