How do I send 2 Headers with Ajax?

0 favourites
  • 3 posts
  • Twitch are making some changes to the way their details are requested. In order to speed things up, I needed to generate a Client ID and a Bearer Token for my app, however, I've only ever needed to run the Bearer Token as my AJAX Header... until now, apparently.

    Starting on April 30, 2020, Helix will require the following:

    Use of OAuth across all endpoints, either via an app access token or user access token.

    The client ID provided in the corresponding header must match the client ID used to generate the OAuth token.

    At first I didn't think this was an issue. After all, I figured I'd just need to add in a line action calling a second header after the first is called. However, I then looked at the Scirra manual, and noticed the following:

    Set request header

    Set a HTTP header on the next AJAX request that is made. After the next AJAX request all the headers set with this action are cleared again, so it only takes effect once.

    Is this going to have a negative affect, or am I free to include as many headers as I'd like?

    Are the headers ONLY cleared once the request is made as the manual suggests, or if I call a second header, is the first replaced? If so, am I meant to call both headers in a single action?

    Thanks in advance!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • It's as it says - after the next AJAX request - so you can set multiple headers. You can check what it sends in the browser's dev tools.

  • So I can set up multiple headers with multiple actions.

    Thanks again, Ashley!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)