diff --git a/src/pages/_app.js b/src/pages/_app.js index 8a67468..5744c81 100644 --- a/src/pages/_app.js +++ b/src/pages/_app.js @@ -1,12 +1,15 @@ import "../styles/globals.css"; import { NextUIProvider } from "@nextui-org/react"; +import { SessionProvider } from "next-auth/react"; -function MyApp({ Component, pageProps }) { +function MyApp({ Component, pageProps: { session, ...pageProps } }) { return ( - - - + + + + + ); } diff --git a/src/pages/api/auth/[...nextauth].js b/src/pages/api/auth/[...nextauth].js new file mode 100644 index 0000000..f3f4af6 --- /dev/null +++ b/src/pages/api/auth/[...nextauth].js @@ -0,0 +1,26 @@ +import NextAuth from "next-auth"; +import CredentialsProvider from "next-auth/providers/credentials"; + +export const authOptions = { + providers: [ + CredentialsProvider({ + name: "Credentials", + credentials: { + username: { label: "Username", type: "text", placeholder: "admin" }, + password: { label: "Password", type: "password" }, + }, + async authorize(credentials, req) { + console.log(credentials); + const user = { id: "1", name: "J Smith", email: "admin@example.com" }; + + if (user) { + return user; + } else { + return null; + } + }, + }), + ], +}; + +export default NextAuth(authOptions);