Skip to content

Commit

Permalink
add missing code verifier to discord provider
Browse files Browse the repository at this point in the history
  • Loading branch information
noxify committed Jan 23, 2025
1 parent ba9b09a commit b4c30fc
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/auth/src/providers/discord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@ const discord = new Discord(env.AUTH_DISCORD_ID, env.AUTH_DISCORD_SECRET, callba

export const name = "Discord"

export const getAuthorizationUrl = (state: string) => {
return discord.createAuthorizationURL(state, [OAuth2Scopes.Identify, OAuth2Scopes.Email])
export const getAuthorizationUrl = (state: string, codeVerifier: string | null) => {
return discord.createAuthorizationURL(state, codeVerifier, [
OAuth2Scopes.Identify,
OAuth2Scopes.Email,
])
}

export const handleCallback = async (code: string) => {
const tokens = await discord.validateAuthorizationCode(code)
export const handleCallback = async (code: string, codeVerifier: string | null) => {
const tokens = await discord.validateAuthorizationCode(code, codeVerifier)

const response = await fetch("https://discord.com/api/users/@me", {
headers: {
Expand Down

0 comments on commit b4c30fc

Please # to comment.