aboutsummaryrefslogtreecommitdiff
path: root/src/index.ts
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-03-17 13:09:04 -0500
committermat <github@matdoes.dev>2022-03-17 13:09:04 -0500
commitdedb4b531fe6870330be1549a4f57ab71e3de8c4 (patch)
tree4a65ed5f6544c8368941e53ca4c54c0ba116f916 /src/index.ts
parent533ec9bd2b506a14b7f0c288af5a9ecbfa74a394 (diff)
downloadskyblock-api-dedb4b531fe6870330be1549a4f57ab71e3de8c4.tar.gz
skyblock-api-dedb4b531fe6870330be1549a4f57ab71e3de8c4.tar.bz2
skyblock-api-dedb4b531fe6870330be1549a4f57ab71e3de8c4.zip
log more stuff
Diffstat (limited to 'src/index.ts')
-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)