Discord OAuth handler for Nuxt.js authentication flows
// Source: https://github.com/atinux/nuxt-auth-utils | License: MIT | Copyright 2023 Sébastien Chopin
// Provided via justclaw.it.com; keep this notice with the code.
import type { RequestEvent } from 'nuxt/server'
import { defineEventHandler, getQuery, sendRedirect, useRuntimeConfig } from 'nuxt/server'
import { $fetch } from 'ofetch'
import { withQuery } from 'ufo'
import { defu } from 'defu'
import { handleMissingConfiguration, handleAccessTokenErrorResponse, getOAuthRedirectURL, handleInvalidState, handleState, requestAccessToken } from '../utils'
import type { OAuthConfig } from '#auth-utils'
export interface OAuthDiscordConfig {
/**
* Discord OAuth Client ID
* @default process.env.NUXT_OAUTH_DISCORD_CLIENT_ID
*/
clientId?: string
/**
* Discord OAuth Client Secret
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key