Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Fernando-Santana-j committed Apr 27, 2024
1 parent cb9480f commit 8731651
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down

0 comments on commit 8731651

Please sign in to comment.