Trying to make a very simple basic thing with js,
send a req and see if one streamer is live.
the docs show a “new secret” button on the manage app page,
but i dont see it?.. the type of app is website integration.
thnx for any help…
Trying to make a very simple basic thing with js,
send a req and see if one streamer is live.
the docs show a “new secret” button on the manage app page,
but i dont see it?.. the type of app is website integration.
thnx for any help…
You create a public application instead of a confidential application
Public applications cannot have client secrets as they (the code you write) are “designed” to live in a world where they cannot protect the secret. (To explain the use case)
So if you are building an application that needs a secret, you have the wrong Client Type, or you can just generate a token via implict auth (or DCF/Device Code Flow)
the client type is set to public.
Exactly, you need another application set to confidential
ok will try again, ty for the help.
I’ve seen your github twitch to discord thing, but it is too intricate for me,
are there any other examples anywhere for such a simple thing as
checking if a stream is live?
in JS after gettin a token
async function checkLive() {
let resp = await fetch(
"https://api.twitch.tv/helix/streams?user_login=foo",
{
"method": "GET",
"headers": {
"Client-ID": client_id,
"Authorization": `Bearer ${access_token}`
}
}
);
if (resp.status != 200) {
// handle error
return;
}
let { data } = await resp.json();
if (data.length == 0) {
// handle stream is not live
return;
}
// stream is live
}
It’s based around using EventSub for a real time notification that a stream started rather than an API call.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.