Dear all,
I’ve been following the https://github.com/twitchdev/extensions-hello-world
example, managed to setup the Dev Rig, generate the Client ID, ownerId and secret
EXT_CLIENT_ID: ej8Iwp02QO0sOlswrIO5sDrC5Khr6U
EXT_SECRET: kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
EXT_OWNER_ID: 402464751
- wire the backend with correct JWT schema.
Now I am stuck at the sendColorBroadcast function
which POSTs to https://api.twitch.tv/extensions/message/${channelId}
My problem is that I face
{“error”:“Bad Request”,“status”:400,“message”:“Invalid client id specified”}
response everytime I make a call:
let testCast = () => {
const headers = {
'Client-Id': "ej8Iwp02QO0sOlswrIO5sDrC5Khr6U",
'Content-Type': 'application/json',
'Authorization': bearerPrefix + addJWT()
};
const body = JSON.stringify({
content_type: 'application/json',
message: JSON.stringify({"test": "set"}),
targets: [ 'broadcast' ]
});
const result = request(
`https://api.twitch.tv/extensions/message/265737932`,
{
method: 'POST',
headers,
body
}
, (err, res) => {
if (err) {
console.log('Message send error', channelId);
} else {
console.log(res.body);
console.log(res.statusCode);
}
});
};
let addJWT = () => {
const payload = {
exp: Math.floor(Date.now() / 1000) + 50000,
user_id: "402464751", // extension owner ID for the call to Twitch PubSub
role: 'external',
channel_id: "265737932",
pubsub_perms: {
send: [ "broadcast" ],
},
};
const key = "kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk";
const secret = Buffer.from(key, 'base64');
return jsonwebtoken.sign(payload, secret, { algorithm: 'HS256' });
};
I checked the ClientId, it matches the Dev Rig. Hardcoded Client-ID it into the header data, generated new project with new credentials, but still am getting this error.
I am at a loss . Do I need to login auth my Client-ID ?
or do I need to generate credentials via https://dev.twitch.tv/extension/create (bypassing Dev Rig) to make the valid?
Any help greatly appreciated,
Gex