Get Ratelimit-Limit headers in JS


#1

Hello, I’ve seen some old post about “Access-Control-Expose-Headers” header, are there any updates on adding them? Currently have to make the Twitch requests from my own server to access the “Ratelimit-Limit” headers.


#2

Not that I’ve heard about.

This is probably a good idea.

If you are doing enough stuff client side to worry about needing to run close to the rate limit, you probably want to be using an “App Access Token”, (if you don’t have a user access token, via implicit auth), and to generate those means using your server with the client ID/secret to generate it. And you don’t want to leak those to the front end really.

So I don’t think Twitch will consider adding it. But you could add it to the Twitch Dev uservoice

https://twitch.uservoice.com/forums/310213-developers

(Basically, unless getting public data, I get my server to do it anyway via Relay, and when I’m doing public I know it’s about 3/4 API requests and no where near the unauthed 30)


#3

Ah oke. I thought I used more quota than i did. Just now I saw that I always had 799/800 remaining so I definitely don’t need to worry or use an App access-token.

Just curios, you don’t happened to know why they don’t have the Ratelimits in “Access-Control-Expose-Headers”?

Thanks for the help!


#4

No idea, my theory is that if you are doing anything that is gonna hammer the API, you already logged in as user via implicit, so you have 800 requests, and it’s actually really hard to get to that limit client side. So there is no need to know/limit. You’ll only hit it if you script goes loopy, and if that happens, chromes likely to kill the tab.

Also possible it was just over looked.


#5

Ah oke. Thanks a lot for the help!