From 85242a056ef15d27381862137e6faefef1f5632b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20FAMIBELLE-PRONZOLA?= Date: Tue, 28 Apr 2026 12:39:29 +0400 Subject: [PATCH] Remove auth --- app/api/auth/[...nextauth]/route.js | 82 ----------------------------- app/layout.js | 11 ++-- 2 files changed, 4 insertions(+), 89 deletions(-) delete mode 100644 app/api/auth/[...nextauth]/route.js diff --git a/app/api/auth/[...nextauth]/route.js b/app/api/auth/[...nextauth]/route.js deleted file mode 100644 index c44b9d9..0000000 --- a/app/api/auth/[...nextauth]/route.js +++ /dev/null @@ -1,82 +0,0 @@ -import NextAuth from "next-auth" -import Credentials from "next-auth/providers/credentials" -import Twitter from "next-auth/providers/twitter" -import Google from "next-auth/providers/google" -import GitHub from "next-auth/providers/github" -import axios from "axios" - -export const { handlers, auth } = NextAuth({ - providers: [ - Credentials({ - credentials: { - username: {}, - password: {} - }, - async authorize(credentials) { - try { - const user = await axios.post( - `${process.env.NEXT_PUBLIC_API_URL}/auth/local`, - { - identifier: credentials.username, - password: credentials.password - } - ) - - return user.data || null - } catch (error) { - throw new Error(error.response?.data?.error?.message) - } - } - }), - Twitter({ - clientId: process.env.NEXT_PUBLIC_TWITTER_API_KEY, - clientSecret: process.env.NEXT_PUBLIC_TWITTER_API_KEY_SECRET - }), - Google({ - clientId: process.env.NEXT_PUBLIC_GOOGLE_CLIENT_ID, - clientSecret: process.env.NEXT_PUBLIC_GOOGLE_CLIENT_SECRET - }), - GitHub({ - clientId: process.env.NEXT_PUBLIC_GITHUB_CLIENT_ID, - clientSecret: process.env.NEXT_PUBLIC_GITHUB_CLIENT_SECRET - }) - ], - session: { - strategy: "jwt", - trustHost: true - }, - secret: process.env.NEXT_PUBLIC_JWT_SECRET, - callbacks: { - async jwt({ token, user, account }) { - if (user && account) { - let url = `${process.env.NEXT_PUBLIC_API_URL}/auth/${account.provider}/callback` - - if (account.provider === "twitter") { - url += `?access_token=${account.oauth_token}&access_secret=${account.oauth_token_secret}` - } else { - url += `?access_token=${account.access_token}` - } - - const response = await fetch(url) - const data = await response.json() - - token.id = data.id || user.id - token.jwt = data.jwt || user.jwt - token.user = data.user || user.user - } - - return token - }, - async session({ session, token }) { - session.jwt = token.jwt - session.user = token.user - return session - } - }, - pages: { - signIn: "/pwopose", - error: "/pwopose" - } -}) - -export const { GET, POST } = handlers \ No newline at end of file diff --git a/app/layout.js b/app/layout.js index 906f645..310f866 100644 --- a/app/layout.js +++ b/app/layout.js @@ -1,6 +1,5 @@ import TopLoader from '../components/top-loader' import Navigasyon from '../components/navigasyon' -import AuthProvider from './auth-provider' import ThemeRegistry from './theme-registy' export const metadata = { @@ -56,12 +55,10 @@ export default async function RootLayout({children, Session}) { - - - - {children} - - + + + {children} +