diff --git a/nextjs/next-siwe-next-auth/app/api/auth/[...nextauth]/route.ts b/nextjs/next-siwe-next-auth/app/api/auth/[...nextauth]/route.ts index 796d42a..78b7c9f 100644 --- a/nextjs/next-siwe-next-auth/app/api/auth/[...nextauth]/route.ts +++ b/nextjs/next-siwe-next-auth/app/api/auth/[...nextauth]/route.ts @@ -15,12 +15,12 @@ declare module 'next-auth' { } } -const nextAuthSecret = process.env.NEXTAUTH_SECRET; +const nextAuthSecret = process.env.NEXTAUTH_SECRET || "change it"; if (!nextAuthSecret) { throw new Error('NEXTAUTH_SECRET is not set'); } -const projectId = process.env.NEXT_PUBLIC_PROJECT_ID; +const projectId = process.env.NEXT_PUBLIC_PROJECT_ID || "b56e18d47c72ab683b10814fe9495694"; // this is a public projectId only to use on localhost if (!projectId) { throw new Error('NEXT_PUBLIC_PROJECT_ID is not set'); } diff --git a/nextjs/next-siwe-next-auth/app/config/index.tsx b/nextjs/next-siwe-next-auth/app/config/index.tsx index b66e2bf..1e6c48a 100644 --- a/nextjs/next-siwe-next-auth/app/config/index.tsx +++ b/nextjs/next-siwe-next-auth/app/config/index.tsx @@ -13,7 +13,7 @@ import { arbitrum, mainnet, sepolia, optimism, AppKitNetwork } from '@reown/appk import { getAddress } from 'viem'; // Get projectId from https://cloud.reown.com -export const projectId = process.env.NEXT_PUBLIC_PROJECT_ID; +export const projectId = process.env.NEXT_PUBLIC_PROJECT_ID || "b56e18d47c72ab683b10814fe9495694"; // this is a public projectId only to use on localhost if (!projectId) throw new Error('Project ID is not defined'); diff --git a/nextjs/next-siwe-next-auth/app/context/index.tsx b/nextjs/next-siwe-next-auth/app/context/index.tsx index 817ef6d..6fb9bd0 100644 --- a/nextjs/next-siwe-next-auth/app/context/index.tsx +++ b/nextjs/next-siwe-next-auth/app/context/index.tsx @@ -18,6 +18,7 @@ createAppKit({ projectId, siweConfig, metadata, + themeMode: 'light', features: { email: true, // default to true socials: ['google', 'x', 'github', 'discord', 'apple', 'facebook', 'farcaster'], diff --git a/nextjs/next-siwe-next-auth/app/layout.tsx b/nextjs/next-siwe-next-auth/app/layout.tsx index efaac37..cb0f6e5 100644 --- a/nextjs/next-siwe-next-auth/app/layout.tsx +++ b/nextjs/next-siwe-next-auth/app/layout.tsx @@ -7,12 +7,14 @@ import { cookieToInitialState } from 'wagmi'; import { wagmiAdapter } from './config'; import AppKitProvider from './context'; -export default function RootLayout({ +export default async function RootLayout({ children, }: Readonly<{ children: React.ReactNode; }>) { - const initialState = cookieToInitialState(wagmiAdapter.wagmiConfig, headers().get('cookie')); + const headersList = await headers(); + const cookie = headersList.get('cookie'); + const initialState = cookieToInitialState(wagmiAdapter.wagmiConfig, cookie); return ( diff --git a/nextjs/next-siwe-next-auth/app/page.tsx b/nextjs/next-siwe-next-auth/app/page.tsx index 2092872..b74166c 100644 --- a/nextjs/next-siwe-next-auth/app/page.tsx +++ b/nextjs/next-siwe-next-auth/app/page.tsx @@ -1,7 +1,10 @@ import styles from "./page.module.css"; + export default function Home() { + + return (