diff options
author | mat <github@matdoes.dev> | 2021-06-29 17:54:50 -0500 |
---|---|---|
committer | mat <github@matdoes.dev> | 2021-06-29 17:54:50 -0500 |
commit | 49ff24343e1c964b6cb82fdf76957ffd2f27d049 (patch) | |
tree | 820a3668e21dffc7eefa53630944412d9d97a129 /src/discord.ts | |
parent | 758ca15277daa11ce1ec86ce7f07ea7beee9eb8f (diff) | |
parent | c0c534dafb54ebf9f95a5054f576ad99de29f232 (diff) | |
download | skyblock-api-49ff24343e1c964b6cb82fdf76957ffd2f27d049.tar.gz skyblock-api-49ff24343e1c964b6cb82fdf76957ffd2f27d049.tar.bz2 skyblock-api-49ff24343e1c964b6cb82fdf76957ffd2f27d049.zip |
Merge branch 'main' of https://github.com/skyblockstats/skyblock-api into main
Diffstat (limited to 'src/discord.ts')
-rw-r--r-- | src/discord.ts | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/discord.ts b/src/discord.ts index 48146b5..fac5438 100644 --- a/src/discord.ts +++ b/src/discord.ts @@ -26,9 +26,13 @@ export interface DiscordUser { mfa_enabled: boolean } -export async function exchangeCode(redirectUri: string, code: string): Promise<TokenResponse> { +export async function exchangeCode(redirectUri: string, code: string): Promise<TokenResponse | null> { const API_ENDPOINT = 'https://discord.com/api/v6' const CLIENT_SECRET = process.env.discord_client_secret + if (!CLIENT_SECRET) { + console.error('discord_client_secret isn\'t in env, couldn\'t login with discord') + return null + } const data = { 'client_id': DISCORD_CLIENT_ID, 'client_secret': CLIENT_SECRET, |