Files
bot_Laytho/utils/getAppAccessToken.js
2023-05-11 01:23:54 +02:00

12 lines
440 B
JavaScript

const axios = require('axios')
module.exports = getAppAccessToken = (async (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) })
})