feat: discord auth

This commit is contained in:
TheClashFruit 2023-08-24 16:23:09 +02:00
parent aecfa26d47
commit 7a526f9983
Signed by: TheClashFruit
GPG key ID: CF4A319B9A73290C

View file

@ -6,10 +6,18 @@ if(typeof authCode !== undefined) {
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
}, },
body: JSON.stringify({ authCode }) body: JSON.stringify({ authCode: authCode })
}) })
.then(res => res.text()) .then(res => res.json())
.then(res => { .then(res => {
console.log(res) fetch('https://discord.com/api/v10/users/@me', {
headers: {
'Authorization': `Bearer ${res.access_token}`
}
})
.then(res => res.json())
.then(res => {
console.log(res)
})
}) })
} }