Skip to content

Commit

Permalink
fix: add discord oauth error (#316)
Browse files Browse the repository at this point in the history
Co-authored-by: Sébastien Chopin <[email protected]>
  • Loading branch information
exitss and atinux authored Jan 21, 2025
1 parent e032674 commit 9282ecb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/runtime/server/lib/oauth/discord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,16 @@ export function defineOAuthDiscordEventHandler({ config, onSuccess, onError }: O
profileRequired: true,
authorizationParams: {},
}) as OAuthDiscordConfig
const query = getQuery<{ code?: string }>(event)
const query = getQuery<{ code?: string, error?: string }>(event)

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

if (query.error) {
return handleAccessTokenErrorResponse(event, 'discord', query, onError)
}

const redirectURL = config.redirectURL || getOAuthRedirectURL(event)

if (!query.code) {
Expand Down

0 comments on commit 9282ecb

Please sign in to comment.