feat: discord auth
This commit is contained in:
parent
aecfa26d47
commit
7a526f9983
12
js/auth.js
12
js/auth.js
|
@ -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 => {
|
||||||
|
fetch('https://discord.com/api/v10/users/@me', {
|
||||||
|
headers: {
|
||||||
|
'Authorization': `Bearer ${res.access_token}`
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(res => res.json())
|
||||||
.then(res => {
|
.then(res => {
|
||||||
console.log(res)
|
console.log(res)
|
||||||
})
|
})
|
||||||
|
})
|
||||||
}
|
}
|
Loading…
Reference in a new issue