start working on next auth

This commit is contained in:
Liam 2022-11-13 20:20:16 +00:00
parent 410c2e1cc5
commit 67a0dccb95
2 changed files with 33 additions and 4 deletions

View File

@ -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 (
<NextUIProvider>
<Component {...pageProps} />
</NextUIProvider>
<SessionProvider session={session}>
<NextUIProvider>
<Component {...pageProps} />
</NextUIProvider>
</SessionProvider>
);
}

View File

@ -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);