23 lines
604 B
JavaScript
23 lines
604 B
JavaScript
const authCode = new URL(document.location).searchParams.get('code')
|
|
|
|
if(typeof authCode !== undefined) {
|
|
fetch('https://crss-api.theclashfruit.workers.dev/login', {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
body: JSON.stringify({ authCode: authCode })
|
|
})
|
|
.then(res => res.json())
|
|
.then(res => {
|
|
fetch('https://discord.com/api/v10/users/@me', {
|
|
headers: {
|
|
'Authorization': `Bearer ${res.access_token}`
|
|
}
|
|
})
|
|
.then(res => res.json())
|
|
.then(res => {
|
|
console.log(res)
|
|
})
|
|
})
|
|
} |