Skip to content

Fix: Siwe several fixes #88

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down
2 changes: 1 addition & 1 deletion nextjs/next-siwe-next-auth/app/config/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down
1 change: 1 addition & 0 deletions nextjs/next-siwe-next-auth/app/context/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ createAppKit({
projectId,
siweConfig,
metadata,
themeMode: 'light',
features: {
email: true, // default to true
socials: ['google', 'x', 'github', 'discord', 'apple', 'facebook', 'farcaster'],
Expand Down
6 changes: 4 additions & 2 deletions nextjs/next-siwe-next-auth/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<html lang='en'>
<body>
Expand Down
3 changes: 3 additions & 0 deletions nextjs/next-siwe-next-auth/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@

import styles from "./page.module.css";


export default function Home() {


return (
<main className={styles.main}>
<appkit-button />
Expand Down