What is the api key? https://api.twitch.tv/helix/users?login=AndreMatosdeSousa&apikey=
and where is talking about that?
As per the documentation https://dev.twitch.tv/docs/authentication#registration
There is anything about the param
To use Twitch API’s you must send at least a Client-ID
header
As an alternative you can send the clientID via URL Parameter, but this is discouraged over the preferred method of a header
It’s better to use the authorization
header instead of or in addition to client-id
whenever you can. If you don’t have a user authorization, use an app authorization token.
Helix (to my knowledge) does not support passing either of these via URL parameters.
https://api.twitch.tv/helix/users?login=AndreMatosdeSousa&apikey=CLIENTID
Why this don’t work?
apikey
is not a term Twitch use.
So how?
curl -H 'Client-ID: SOMECLIENT' \
-X GET 'https://api.twitch.tv/helix/users?login=AndreMatosdeSousa'
It can’t be passed as a param? Just for testing
Test with a header like how you would do it in production
If you click on the link you shared in your first post, you’ll get the error: “Must provide a valid Client-ID or OAuth token”.
This error refers to the Client-ID authorization (OAuth) that 3ventic and barry brought up previously. To get a client-id, you’ll need to create an application here: https://dev.twitch.tv/dashboard/apps/create
To get an oauth (authorization) token, you’ll need to read the link that barry shared above. It requires using an application that you registered to authenticate the user and generate a token.
You can use either the client-id or the oauth token to then perform the request you originally stated.
But there is some way without headers?
If you wanna test in the browser we tend to use @3ventic chrome extension https://chrome.google.com/webstore/detail/twitch-client-id-injector/okebcaancimcjdklkimjgcpcamnbkhli
Which sends the header for us
If you’re trying to just test, I’d recommend using Postman for testing things out. You can send API calls with headers and such just as if you were sending them programatically with your code.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.