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
This commit is contained in:
64
frontend/app/api/auth/[...nextauth]/route.ts
Normal file
64
frontend/app/api/auth/[...nextauth]/route.ts
Normal file
@@ -0,0 +1,64 @@
|
||||
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 }
|
||||
Reference in New Issue
Block a user