W n8n
This commit is contained in:
parent
f4a730422c
commit
a7428913d0
@ -15,6 +15,17 @@ interface MissionUserInput {
|
||||
|
||||
// Helper function to check authentication
|
||||
async function checkAuth(request: Request) {
|
||||
// Check for API key first
|
||||
const apiKey = request.headers.get('x-api-key');
|
||||
console.log('Received API key:', apiKey);
|
||||
console.log('Expected API key:', process.env.N8N_API_KEY);
|
||||
console.log('API key match:', apiKey === process.env.N8N_API_KEY);
|
||||
|
||||
if (apiKey === process.env.N8N_API_KEY) {
|
||||
return { authorized: true, userId: 'system' };
|
||||
}
|
||||
|
||||
// If no API key, check for session
|
||||
const session = await getServerSession(authOptions);
|
||||
if (!session?.user?.id) {
|
||||
console.error('Unauthorized access attempt:', {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user