+ Could not load your guild information from Discord: {error}
+
+
+ Try again
+
+
+
+ )}
+ {authGuildRes.fetching &&
+ 'Loading your guild information from Discord...'}
+
+ );
+};
+
+export default GuildSetupAuthCallback;
\ No newline at end of file
diff --git a/packages/web/pages/join/guild/start.tsx b/packages/web/pages/join/guild/start.tsx
new file mode 100644
index 00000000..f8305872
--- /dev/null
+++ b/packages/web/pages/join/guild/start.tsx
@@ -0,0 +1,101 @@
+import {
+ Box,
+ Flex,
+ ListItem,
+ MetaButton,
+ MetaHeading,
+ Text,
+ UnorderedList,
+} from '@metafam/ds';
+import { Constants, generateUUID } from '@metafam/utils';
+import { CONFIG } from 'config';
+import { useUser } from 'lib/hooks';
+import { get, set } from 'lib/store';
+import React, { lazy,useEffect, useState } from 'react';
+
+const discordOAuthCallbackURL = `${CONFIG.publicURL}/${Constants.DISCORD_OAUTH_CALLBACK_PATH}`;
+export const discordAuthStateGuidKey = 'metagame-add-guild';
+
+const PageContainer = lazy(() => import('components/Container'));
+
+const GuildSetupAuthCallback: React.FC = () => {
+ const { user } = useUser();
+
+ const [stateGuid, setStateGuid] = useState();
+
+ useEffect(() => {
+ let guid = get(discordAuthStateGuidKey);
+ if (guid == null) {
+ guid = generateUUID();
+ set(discordAuthStateGuidKey, guid);
+ }
+ setStateGuid(guid);
+ }, [setStateGuid]);
+
+ const discordAuthParams = new URLSearchParams({
+ response_type: 'code',
+ client_id: Constants.DISCORD_BOT_CLIENT_ID,
+ // This will be passed-back and verified after the Discord auth redirect
+ state: stateGuid as string,
+ permissions: Constants.JOIN_GUILD_DISCORD_BOT_PERMISSIONS,
+ redirect_uri: encodeURI(discordOAuthCallbackURL),
+ scope: Constants.JOIN_GUILD_DISCORD_OAUTH_SCOPES,
+ });
+
+ const discordAuthURL = `${
+ CONFIG.discordAPIBaseUrl
+ }/oauth2/authorize?${discordAuthParams.toString()}`;
+
+ return (
+
+ Join as a Guild
+
+ {stateGuid?.length && user ? (
+ <>
+
+ Clicking the link below will redirect to a Discord page asking for
+ your permission to collect this information about your guild from
+ your guild's Discord server:
+
+
+ Read messages / history. Optional, but this allows us
+ to display announcements from your Discord announcements
+ channel(s) on your MyMeta guild's page.
+
+
+
+
+ Wait, why Discord?
+
+
+ Well, turns out that (at this moment anyway) there is no
+ standardized source of truth for determining who is a "member" of
+ a guild. We built an integration with Discord because just about
+ every guild has a Discord server. Most servers use roles to give
+ certain community members additional privileges, which is often a
+ good approximation for "membership". So, by linking your Discord
+ server and telling us what roles determine what, we can determine
+ which MyMeta users are members of your guild!
+
+
+ Join
+
+ >
+ ) : (
+
+ Please log in or create a player profile by pressing the "Connect"
+ button to start the guild setup process.
+
+ )}
+
+
+ );
+};
+
+export default GuildSetupAuthCallback;
\ No newline at end of file