Files
bot_Laytho/utils/validateToken.js
2023-05-11 00:37:16 +02:00

13 lines
403 B
JavaScript

const axios = require('axios')
module.exports = async function (access_token) {
return await axios.get('https://id.twitch.tv/oauth2/validate', {
headers: {
'Authorization': `OAuth ${access_token}`,
}
}).then(response => {
//console.log(response.data)
if (response.data.status === '401') return false
else return true
}).catch(error => { console.log(error.response.data) })
}