Files
Neon-Desk/frontend/app/api/auth/[...nextauth]/route.ts
Francesco da58289eb1 feat: Complete Fiscal Clone deployment package
- SEC filings extraction (10-K, 10-Q, 8-K)
- Portfolio analytics with real-time prices
- Watchlist management
- NextAuth.js authentication
- OpenClaw AI integration
- PostgreSQL database with auto P&L calculations
- Elysia.js backend (Bun runtime)
- Next.js 14 frontend (TailwindCSS + Recharts)
- Production-ready Docker configurations
2026-02-16 03:49:32 +00:00

65 lines
1.6 KiB
TypeScript

import NextAuth from 'next-auth'
import GitHub from 'next-auth/providers/github'
import Google from 'next-auth/providers/google'
import Credentials from 'next-auth/providers/credentials'
const handler = NextAuth({
providers: [
GitHub({
clientId: process.env.GITHUB_ID,
clientSecret: process.env.GITHUB_SECRET,
}),
Google({
clientId: process.env.GOOGLE_ID,
clientSecret: process.env.GOOGLE_SECRET,
}),
Credentials({
name: 'Credentials',
credentials: {
email: { label: "Email", type: "email" },
password: { label: "Password", type: "password" }
},
async authorize(credentials) {
// Call backend API to verify credentials
const res = await fetch(`${process.env.NEXT_PUBLIC_API_URL}/api/auth/login`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(credentials)
})
const user = await res.json()
if (res.ok && user) {
return user
}
return null
}
})
],
pages: {
signIn: '/auth/signin',
},
callbacks: {
async jwt({ token, user }) {
if (user) {
token.id = user.id
token.email = user.email
token.name = user.name
}
return token
},
async session({ session, token }) {
if (session.user) {
session.user.id = token.id
session.user.email = token.email
}
return session
}
},
session: {
strategy: 'jwt',
maxAge: 30 * 24 * 60 * 60, // 30 days
}
})
export { handler as GET, handler as POST }