Skip to content

Commit 9282ecb

Browse files
exitssatinux
andauthored
fix: add discord oauth error (#316)
Co-authored-by: Sébastien Chopin <[email protected]>
1 parent e032674 commit 9282ecb

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/runtime/server/lib/oauth/discord.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,16 @@ export function defineOAuthDiscordEventHandler({ config, onSuccess, onError }: O
6767
profileRequired: true,
6868
authorizationParams: {},
6969
}) as OAuthDiscordConfig
70-
const query = getQuery<{ code?: string }>(event)
70+
const query = getQuery<{ code?: string, error?: string }>(event)
7171

7272
if (!config.clientId || !config.clientSecret) {
7373
return handleMissingConfiguration(event, 'discord', ['clientId', 'clientSecret'], onError)
7474
}
7575

76+
if (query.error) {
77+
return handleAccessTokenErrorResponse(event, 'discord', query, onError)
78+
}
79+
7680
const redirectURL = config.redirectURL || getOAuthRedirectURL(event)
7781

7882
if (!query.code) {

0 commit comments

Comments
 (0)