Discord OAuth2 Provider (provider/discord.ts)

openauth · packages/openauth/src/provider/discord.ts · typescript · MIT
auth, chat, fw:node, tag:provider

Implements Discord OAuth2 authentication for OpenAuth, enabling login via Discord accounts in web applications.

// Source: https://github.com/anomalyco/openauth | License: MIT | Copyright 2024 SST
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * Use this provider to authenticate with Discord.
 *
 * ```ts {5-8}
 * import { DiscordProvider } from "@openauthjs/openauth/provider/discord"
 *
 * export default issuer({
 *   providers: {
 *     discord: DiscordProvider({
 *       clientID: "1234567890",
 *       clientSecret: "0987654321"
 *     })
 *   }
 * })
 * ```
 *
 * @packageDocumentation
 */

import { Oauth2Provider, Oauth2WrappedConfig } from "./oauth2.js"

export interface DiscordConfig extends Oauth2WrappedConfig {}

/**
 * Create a Discord OAuth2 provider.
 *
 * @param config - The config for the provider.
 * @example
 * ```ts
 * DiscordProvider({
 *   clientID: "12345678

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key