Comments (4)
Oh right. Might be worth mentioning this in the doc of get_users
, or/and GetUsersRequest
.
from twitch_api.
the url we call for
get_users::GetUsersRequest::builder()
.id(vec![])
.login(vec![])
.build();
would be https://api.twitch.tv/helix/users?
(check with request.get_uri()
)
calling this is special-cased by twitch, where it returns the current user. For me for example
I'm not sure I understand the issue here. Where is the error?
from twitch_api.
This is interesting, it seems the behavior is different in the browser. Probably because you have some form of cookie?
Here's an example exhibiting the problem:
use twitch_api2::{twitch_oauth2::AppAccessToken, TwitchClient};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client_id = std::env::var("TWITCH_CLIENT_ID").unwrap().into();
let client_secret = std::env::var("TWITCH_CLIENT_SECRET").unwrap().into();
let client: TwitchClient<reqwest::Client> = TwitchClient::default();
let token = AppAccessToken::get_app_access_token(&client, client_id, client_secret, vec![])
.await
.unwrap();
let req = twitch_api2::helix::users::get_users::GetUsersRequest::builder()
.id(vec![])
.login(vec![])
.build();
let resp = client.helix.req_get(req, &token).await;
dbg!(&resp);
resp.expect("valid response");
Ok(())
}
This gives:
[src/testtwitch.rs:18] &resp = Err(
HelixRequestGetError(
Error {
error: "Bad Request",
status: 400,
message: "Must provide an ID, Login or OAuth Token.",
uri: https://api.twitch.tv/helix/users?,
},
),
)
thread 'main' panicked at 'valid response: HelixRequestGetError(Error { error: "Bad Request", status: 400, message: "Must provide an ID, Login or OAuth Token.", uri: https://api.twitch.tv/helix/users? })', src/testtwitch.rs:19:10
I'm using tokio
version "1.0.1" and twitch_api
version 0.6.0-rc.3
from twitch_api.
Aha, no default user associated with apptokens so twitch throws an error on empty query. There are no differences with using a browser, I jus have an addon setting the correct headers, using an user token.
I dont think it's possible or usable for twitch_api2 to catch this kind of error without speaking to twitch.
from twitch_api.
Related Issues (20)
- Impossible to use requests / body with DeserializeOwned HOT 5
- EventSub Over WebSocket HOT 3
- Why can't I put multiple broadcaster_id in GetChannelInformationRequest? HOT 2
- Games: Get Games and Get Top Games IGDB Field
- Help appreciated (get_followed_streams) HOT 2
- Getting a backtrace with a specific broadcaster id 418158680 HOT 2
- introduce `beta` feature for public betas instead of `unsupported`
- Make `helix::client::custom` first-class
- another bug while decoding teaminfo HOT 4
- Add way to mock responses
- Investigate querying twitch docs HOT 1
- sprinkle more must_use on all structs
- Bors deprecation - remaining
- Clarify how or make it easier to pass in collections that are T: Iterator<Item=D> in builder functions for helix requests HOT 4
- Create a tower rate limiter for helix which respects twitch headers
- use `async fn` and return-position `impl Trait` in trait HOT 1
- Enum twitch_api::eventsub::Status unknown variant `websocket_failed_to_reconnect` HOT 2
- reqwest 0.12 upgraded hyper, http, and http-body to v1, causing build failures
- Update to reqwest 0.12 make error "trait `twitch_api::HttpClient` is not implemented for `reqwest::Client`" HOT 8
- Future incompatibility with Rust RFC 3373: Avoid non-local definitions in functions 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 twitch_api.