12 lines
402 B
JavaScript
12 lines
402 B
JavaScript
const axios = require('axios')
|
|
|
|
module.exports = getUserID = (async (client_id, access_token, login) => {
|
|
return await axios.get(`https://api.twitch.tv/helix/users?login=${login}`, {
|
|
headers: {
|
|
'Authorization': `Bearer ${access_token}`,
|
|
'Client-Id': client_id
|
|
}
|
|
}).then(response => {
|
|
return response.data.data[0].id
|
|
}).catch(error => { console.error(error.response.data) })
|
|
}) |