Files
bot_Laytho/utils/getAppAccessToken.js
2023-05-09 00:32:43 +02:00

12 lines
424 B
JavaScript

const axios = require('axios')
module.exports = async function (client_id, client_secret) {
return await axios.post('https://id.twitch.tv/oauth2/token', {
client_id,
client_secret,
grant_type: 'client_credentials'
}).then(response => {
//console.log(response.data)
if (response.data.token_type === 'bearer') return response.data.access_token
}).catch(error => { console.log(error.response.data) })
}