Panel terminé + Refresh token auto

This commit is contained in:
Zachary Guénot
2023-05-11 00:37:16 +02:00
parent de01c981f8
commit 8846299424
18 changed files with 251 additions and 64 deletions

13
utils/refreshToken.js Normal file
View File

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