Skip to content

Commit

Permalink
update routes and add some more logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Androz2091 committed Sep 8, 2024
1 parent 051563c commit cc33747
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/routes/auth.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,18 @@ authRouter.get('/callback', async (req, res) => {
}
});
const tokenData = await tokenResponse.json();
console.log(`[LOGIN] Token data = ${JSON.stringify(tokenData)}`);
if (tokenData.error || !tokenData.access_token) {
res.send(500);
socket.emit('authFailed');
return;
}
const accessToken = tokenData.access_token;

console.log(`[LOGIN] Access token = ${accessToken}`);

// TODO: handle ratelimiting
const userResponse = await fetch('http://discordapp.com/api/users/@me', {
const userResponse = await fetch('https://discord.com/api/users/@me', {
method: 'GET',
headers: {
Authorization: `Bearer ${accessToken}`
Expand Down

0 comments on commit cc33747

Please sign in to comment.