Setting X-DreamFactory-Api-Key and X-DreamFactory-Session-Token from NodeJs


#1

How do you set - X-DreamFactory-Api-Key and X-DreamFactory-Session-Token from Nodejs.
I am receiving this error - I think the API key and session is not set as string - its geeting too huge string. How can this be set in the headers ?

/Users/Vineet/Development/NodeJsProjects/App.js:22
’X-DreamFactory-Api-Key’: data.apikey,
^^^^^^^^^^^^^^^^^^^^^^^^

SyntaxError: Unexpected string
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions…js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:441:10)
at startup (node.js:139:18)
at node.js:968:3


#2

Nevermind - I missed to add the Accept header. It worked after adding

‘Accept’: ‘application/json’,


#3

Hey @Vineet_Chauhan glad to hear that you figured it out and it’s working for you now.

Than kyou for coming back and updating the thread and your fix! That way, other community folks can learn too. :slight_smile:

Thanks,
@AlexBowen