aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/index.ts5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/index.ts b/src/index.ts
index 8cff430..3e73ad3 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -164,8 +164,9 @@ app.post('/accounts/createsession', async (req, res) => {
const { access_token: accessToken, refresh_token: refreshToken } = codeExchange
if (!accessToken) {
// access token is invalid :(
- console.log('error exchanging code:', codeExchange)
- return res.json({ ok: false })
+ console.log('error exchanging code:', codeExchange, code)
+ const { error, error_description: errorDescription } = codeExchange as any
+ return res.json({ ok: false, error: error ? `Discord error: ${error}: ${errorDescription}` : 'Unknown error' })
}
const userData = await discord.getUser(accessToken)
const sessionId = await createSession(refreshToken, userData)