Connexion OAuth depuis site + Comptage rewards SQL
This commit is contained in:
21
utils/subscribeToEvents.js
Normal file
21
utils/subscribeToEvents.js
Normal file
@@ -0,0 +1,21 @@
|
||||
const axios = require('axios')
|
||||
|
||||
module.exports = async function (access_token, session_id, client_id, type, version, condition) {
|
||||
return await axios.post('https://api.twitch.tv/helix/eventsub/subscriptions', {
|
||||
type,
|
||||
version,
|
||||
condition,
|
||||
transport: {
|
||||
method: 'websocket',
|
||||
session_id
|
||||
}
|
||||
}, {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${access_token}`,
|
||||
'Client-Id': client_id,
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
}).then(response => {
|
||||
return response.data.data[0].status
|
||||
}).catch(error => { return error.response.data })
|
||||
}
|
||||
Reference in New Issue
Block a user