Panel terminé + Refresh token auto
This commit is contained in:
13
utils/validateToken.js
Normal file
13
utils/validateToken.js
Normal file
@@ -0,0 +1,13 @@
|
||||
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) })
|
||||
}
|
||||
Reference in New Issue
Block a user