Best answer

getting response headers for auth in code mode

  • 28 April 2021
  • 1 reply

I need to be able to get the response headers in Step 2 “Configure Token Exchange Request” of session auth because the session info I need to save is in the headers, not the main body of the response.  I’ve tried the following:




Everything I try either causes it to fail to completely or just doesn’t return any information. Is there a correct syntax in Zapier to get response headers here? For example:


return z.request(options)
  .then((response) => {

     var session = Here’s where I need to grab session info from the headers.

    return {
      'sessionKey': session




Best answer by Zane 29 April 2021, 00:48

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

1 reply

Userlevel 7
Badge +9

This may or may not be helpful, but when working in code mode it’s often useful to refer to the CLI docs. They’ll have more detail than that the docs for the UI.

I can’t see, in context, how you’re referencing those headers, but another general tip is to use z.console.log() to dump exactly what’s in an object to make sure it contains what you expect - and using JSON.stringify() to see dictionaries, etc.  Also check out the HTTP logs to verify the headers and their names.

If none of that gets you unstuck, post some logs and the full code and maybe someone can spot the problem.