mirror of
https://github.com/neynarxyz/create-farcaster-mini-app.git
synced 2025-11-15 15:48:56 -05:00
fix: siwn csrf config
This commit is contained in:
parent
feb9f3e161
commit
ea7ee37e71
@ -4,8 +4,3 @@ KV_REST_API_TOKEN=''
|
|||||||
KV_REST_API_URL=''
|
KV_REST_API_URL=''
|
||||||
NEXT_PUBLIC_URL='http://localhost:3000'
|
NEXT_PUBLIC_URL='http://localhost:3000'
|
||||||
NEXTAUTH_URL='http://localhost:3000'
|
NEXTAUTH_URL='http://localhost:3000'
|
||||||
|
|
||||||
NEXTAUTH_SECRET=""
|
|
||||||
NEYNAR_API_KEY=""
|
|
||||||
NEYNAR_CLIENT_ID=""
|
|
||||||
USE_TUNNEL="false"
|
|
||||||
|
|||||||
@ -693,6 +693,7 @@ export async function init(projectName = null, autoAcceptDefaults = false, apiKe
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (answers.seedPhrase) {
|
if (answers.seedPhrase) {
|
||||||
|
console.log('✅ Writing SEED_PHRASE and NEXTAUTH_SECRET to .env.local');
|
||||||
fs.appendFileSync(envPath, `\nSEED_PHRASE="${answers.seedPhrase}"`);
|
fs.appendFileSync(envPath, `\nSEED_PHRASE="${answers.seedPhrase}"`);
|
||||||
// Add NextAuth secret for SIWN
|
// Add NextAuth secret for SIWN
|
||||||
fs.appendFileSync(
|
fs.appendFileSync(
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@neynar/create-farcaster-mini-app",
|
"name": "@neynar/create-farcaster-mini-app",
|
||||||
"version": "1.8.1",
|
"version": "1.8.2",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"private": false,
|
"private": false,
|
||||||
"access": "public",
|
"access": "public",
|
||||||
|
|||||||
14
src/auth.ts
14
src/auth.ts
@ -274,7 +274,7 @@ export const authOptions: AuthOptions = {
|
|||||||
? `https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}`
|
? `https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}`
|
||||||
: process.env.VERCEL_URL
|
: process.env.VERCEL_URL
|
||||||
? `https://${process.env.VERCEL_URL}`
|
? `https://${process.env.VERCEL_URL}`
|
||||||
: `http://localhost:${process.env.PORT ?? 3000}`;
|
: process.env.NEXTAUTH_URL || `http://localhost:${process.env.PORT ?? 3000}`;
|
||||||
|
|
||||||
const domain = getDomainFromUrl(baseUrl);
|
const domain = getDomainFromUrl(baseUrl);
|
||||||
|
|
||||||
@ -339,26 +339,26 @@ export const authOptions: AuthOptions = {
|
|||||||
name: `next-auth.session-token`,
|
name: `next-auth.session-token`,
|
||||||
options: {
|
options: {
|
||||||
httpOnly: true,
|
httpOnly: true,
|
||||||
sameSite: 'none',
|
sameSite: process.env.NODE_ENV === 'production' ? 'none' : 'lax',
|
||||||
path: '/',
|
path: '/',
|
||||||
secure: true,
|
secure: process.env.NODE_ENV === 'production',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
callbackUrl: {
|
callbackUrl: {
|
||||||
name: `next-auth.callback-url`,
|
name: `next-auth.callback-url`,
|
||||||
options: {
|
options: {
|
||||||
sameSite: 'none',
|
sameSite: process.env.NODE_ENV === 'production' ? 'none' : 'lax',
|
||||||
path: '/',
|
path: '/',
|
||||||
secure: true,
|
secure: process.env.NODE_ENV === 'production',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
csrfToken: {
|
csrfToken: {
|
||||||
name: `next-auth.csrf-token`,
|
name: `next-auth.csrf-token`,
|
||||||
options: {
|
options: {
|
||||||
httpOnly: true,
|
httpOnly: true,
|
||||||
sameSite: 'none',
|
sameSite: process.env.NODE_ENV === 'production' ? 'none' : 'lax',
|
||||||
path: '/',
|
path: '/',
|
||||||
secure: true,
|
secure: process.env.NODE_ENV === 'production',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -569,6 +569,8 @@ export function NeynarAuthButton() {
|
|||||||
} else {
|
} else {
|
||||||
console.error('❌ Backend sign-in error:', e);
|
console.error('❌ Backend sign-in error:', e);
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
setSignersLoading(false);
|
||||||
}
|
}
|
||||||
}, [nonce]);
|
}, [nonce]);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user