Skip to content

DiscordProvider

Reference doc for the `DiscordProvider`.

Use this provider to authenticate with Discord.

import { DiscordProvider } from "@openauthjs/openauth/provider/discord"
export default issuer({
providers: {
discord: DiscordProvider({
clientId: "1234567890",
clientSecret: "0987654321"
})
}
})

Methods

DiscordProvider

DiscordProvider(config)

Parameters

Returns Provider

Create a Discord OAuth2 provider.

DiscordProvider({
clientId: "1234567890",
clientSecret: "0987654321"
})

DiscordConfig

DiscordConfig.clientID

Type string

The client ID.

This is just a string to identify your app.

{
clientID: "my-client"
}

DiscordConfig.clientSecret

Type string

The client secret.

This is a private key that’s used to authenticate your app. It should be kept secret.

{
clientSecret: "0987654321"
}

DiscordConfig.query?

Type Record<string, string>

Any additional parameters that you want to pass to the authorization endpoint.

{
query: {
access_type: "offline",
prompt: "consent"
}
}

DiscordConfig.scopes

Type string[]

A list of OAuth scopes that you want to request.

{
scopes: ["email", "profile"]
}