Comments (11)
Hey thx a lot, sorry was planning to do it tonight after work... you are too fast for me ;-)
from helix.
Oh and I tested with the same client-id, app token and secret and I got a ratelimit-rate of 120 with postman with the same endpoint:
ratelimit-limit →120
ratelimit-remaining →119
from helix.
Do you mind posting the code you're using so that I can replicate your issue. But don't include your tokens, I have my own.
from helix.
Never mind, I've just replicated the issue. It appears the Authorization
header is not being attached to the request.
from helix.
Actually, this appears to work as expected:
client, err := helix.NewClient(&helix.Options{
ClientID: "your-client-id",
UserAccessToken: "your-user-access-token",
})
if err != nil {
log.Fatal(err)
}
resp, _ := client.GetStreams(&helix.StreamsParams{
First: 1,
})
fmt.Printf("%+v\n", resp)
Output:
&{ResponseCommon:{StatusCode:200 Error: ErrorStatus:0 ErrorMessage: RateLimit:{Limit:120 Remaining:119 Reset:1528279075} StreamsMetadataRateLimit:{Limit:0 Remaining:0} ClipsCreationRateLimit:{Limit:0 Remaining:0}} Data:{Streams:[{ID:28982088016 UserID:87056709 GameID:29595 CommunityIDs:[] Type:live Title:Mineski vs Vici Gaming China Dota2 Supermajor Playoffs Day 3 (Lower bracket) ViewerCount:60554 StartedAt:2018-06-06 08:17:57 +0000 UTC Language:en ThumbnailURL:https://static-cdn.jtvnw.net/previews-ttv/live_user_pgl_dota2-{width}x{height}.jpg}] Pagination:{Cursor:eyJiIjpudWxsLCJhIjp7Ik9mZnNldCI6MX19}}}
As you can see from the output the rate limit is 120 with 119 requests remaining.
from helix.
Hello thx for your answer.
In my use case I just want to use the AppAccessToken with getstreams endpoint, so not the useraccesstoken. Can you try to reproduce it with that context?
from helix.
So here's my code...
I'm taking an appAccessToken:
client, err := helix.NewClient(&helix.Options{
ClientID: myClientID,
ClientSecret: myClientSecret,
})
if err != nil {
// handle error
}
resp, err := client.GetAppAccessToken()
if err != nil {
// handle error
}
//fmt.Printf("%+v\n", resp)
var myAppToken string = resp.Data.AccessToken
And then I'm trying to get streams for a specific game:
client, err := helix.NewClient(&helix.Options{
ClientID: myClientID,
ClientSecret: myClientSecret,
AppAccessToken: myAppToken,
})
if err != nil {
// handle error
}
resp, err := client.GetStreams(&helix.StreamsParams{
First: 100,
GameIDs: []string{streamID},
After: afterPagination,
})
if err != nil {
// handle error
}
In the response I've got a ratelimit of 30... if I do the same request through PostMan I'm getting a 120!
from helix.
This appears to be the issue: https://github.com/nicklaw5/helix/blob/master/helix.go#L337-L339
We are only attaching the app access token for the Create Entitlement Grants Upload endpoint, as that is the only endpoint that specifies its use. The Twitch docs aren't very helpful. I wasn't aware that it is possible to use app access tokens for other requests.
from helix.
Yeah i know the doc doesn’t mention it’s possible or other endpoint, I spent time to search and understand myself ;-) so can you add the possibility to specify the appAccessToken? I guess that if your have app and user access token passed you take user one, and if you have only the app you use this one?
from helix.
Sure can. Did you want to put together a PR yourself? Otherwise I can probably get to it over the weekend?
from helix.
@jscoys That's been fixed in fc3312c. I've also cut a new release so be sure to update your dependency manager if you use one.
Thanks for reporting it.
from helix.
Related Issues (20)
- Allow querying multiple channels with `GetChannelInformation`
- Proposal: Add option to pass in state for each API request HOT 5
- Proposal: Add default rate limit function HOT 2
- Client does not use AppAccessToken on calls that must use AppAccessToken HOT 4
- missing api endpoints
- Need to add VodOffset. HOT 2
- Latest Release is 12.13.0 not 2.13.0 HOT 1
- Endpoint errors but returned error is nil
- Support `tags` for the stream resource HOT 1
- Implement Schedule endpoints
- Auto Refreshing Access Tokens
- Update follows endpoint to new version HOT 1
- When scope for endpoint is missing in the access token, it gets locked in a loop refreshing the access token
- Proposal: Context for methods, not for struct itself
- GetBlockedTerms() does not use provided data HOT 2
- AddBlockedTerm() does not use provided data HOT 2
- Add send message endpoint request
- GetBannedUsers() returns nothing HOT 14
- event EventSubChannelPredictionEndEvent json ended_at typo HOT 1
- Most recent patch release broke "API" HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from helix.