From 8731651552c5ef78c5e8d20943767cb5721c798a Mon Sep 17 00:00:00 2001 From: Fernando Date: Sat, 27 Apr 2024 15:01:05 -0300 Subject: [PATCH] fix --- index.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 2687c7d..d2687ca 100644 --- a/index.js +++ b/index.js @@ -166,7 +166,9 @@ app.get('/auth/callback', async (req, res) => { 'Content-Type': 'application/x-www-form-urlencoded', 'Accept-Encoding': 'application/x-www-form-urlencoded' }; - const response = await axios.post('https://discord.com/api/oauth2/token', param, { headers }).then((res) => { return res }).catch((err) => console.error(err)) + const response = await axios.post('https://discord.com/api/oauth2/token', param, { headers }).then((res) => { return res }).catch((err) => { + res.redirect('/logout') + console.error(err)}) if (!response) { res.redirect('/logout') return @@ -176,7 +178,10 @@ app.get('/auth/callback', async (req, res) => { Authorization: `Bearer ${response.data.access_token}`, ...headers } - }).then((res) => { return res.data }).catch((err) => console.error(err)); + }).then((res) => { return res.data }).catch((err) => { + res.redirect('/logout') + console.error(err) + }); await db.create('users', userResponse.id, { id: userResponse.id, username: userResponse.username,