-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(discord): enhance token refresh and streamline auth flow (#371)
* feat(discord): enhance token refresh and role management Implements robust Discord token refresh mechanism in auth flow and improves role management for Discord-connected users. Adds proper error handling for Discord API interactions and streamlines the account linking process. * refactor(discord): streamline auth flow and directory structure Reorganizes Discord integration files for better maintainability: - Consolidates Discord connection UI components - Removes redundant callback pages - Updates environment configuration - Refines Inngest function setup for Discord operations * fix: bad line --------- Co-authored-by: Vojta Holik <vojta@egghead.io>
- Loading branch information
1 parent
32648d0
commit 44acce6
Showing
11 changed files
with
72 additions
and
228 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,28 @@ | ||
import { notFound, redirect } from 'next/navigation' | ||
import { env } from '@/env.mjs' | ||
import * as React from 'react' | ||
import { headers } from 'next/headers' | ||
import { getProviders } from '@/server/auth' | ||
|
||
import { DiscordConnectButton } from './discord-connect-button' | ||
|
||
export default async function Discord() { | ||
if (env.NEXT_PUBLIC_DISCORD_INVITE_URL === undefined) { | ||
console.error('Discord invite URL is not set') | ||
return notFound() | ||
} | ||
redirect(env.NEXT_PUBLIC_DISCORD_INVITE_URL) | ||
await headers() | ||
|
||
const providers = getProviders() | ||
|
||
const discordProvider = providers?.discord | ||
|
||
return ( | ||
<main data-login-template=""> | ||
<h1 data-title=""> | ||
Join {process.env.NEXT_PUBLIC_PARTNER_FIRST_NAME}{' '} | ||
{process.env.NEXT_PUBLIC_PARTNER_LAST_NAME}'s AI Hero Discord | ||
</h1> | ||
|
||
<div data-providers-container=""> | ||
{discordProvider ? ( | ||
<DiscordConnectButton discordProvider={discordProvider} /> | ||
) : null} | ||
</div> | ||
</main> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { notFound, redirect } from 'next/navigation' | ||
import { env } from '@/env.mjs' | ||
|
||
export default async function Discord() { | ||
if (env.NEXT_PUBLIC_DISCORD_INVITE_URL === undefined) { | ||
console.error('Discord invite URL is not set') | ||
return notFound() | ||
} | ||
redirect(env.NEXT_PUBLIC_DISCORD_INVITE_URL) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.