Skip to content

Commit

Permalink
add discord oauth error
Browse files Browse the repository at this point in the history
  • Loading branch information
exitss authored Dec 28, 2024
1 parent ec9b727 commit 5d820d9
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 5d820d9

Please sign in to comment.