feat: discord auth
This commit is contained in:
parent
aecfa26d47
commit
7a526f9983
14
js/auth.js
14
js/auth.js
|
@ -6,10 +6,18 @@ if(typeof authCode !== undefined) {
|
|||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({ authCode })
|
||||
body: JSON.stringify({ authCode: authCode })
|
||||
})
|
||||
.then(res => res.text())
|
||||
.then(res => res.json())
|
||||
.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)
|
||||
})
|
||||
})
|
||||
}
|
Loading…
Reference in a new issue