mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2024-11-17 09:23:07 +02:00
fix: revoke token on logout
This commit is contained in:
parent
daadb5fe85
commit
f55ee02ce5
@ -1,7 +1,13 @@
|
|||||||
module.exports.get = () => ({
|
module.exports.get = fastify => ({
|
||||||
handler: async function (req, res) {
|
handler: async function (req, res) {
|
||||||
|
await fetch('https://discord.com/api/oauth2/token/revoke', {
|
||||||
|
body: new URLSearchParams({ token: req.user.payload.accessToken }).toString(),
|
||||||
|
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||||
|
method: 'POST',
|
||||||
|
});
|
||||||
res
|
res
|
||||||
.clearCookie('token', '/')
|
.clearCookie('token', '/')
|
||||||
.send('Logged out.');
|
.send('The token has been revoked.');
|
||||||
},
|
},
|
||||||
|
onRequest: [fastify.authenticate],
|
||||||
});
|
});
|
Loading…
Reference in New Issue
Block a user