re-add providers lol. also add all dashboard paths to middleware

This commit is contained in:
StephDietz
2023-09-20 13:36:07 -05:00
parent 2ad29a79e1
commit 63a96ce7a1
5 changed files with 16 additions and 8 deletions

View File

@@ -1,6 +1,4 @@
GITHUB_SECRET_ID="5f7808e2598546bc7cd9f955853622ac1ca8bb9a"
GITHUB_CLIENT_ID="28f99c4bf5597685d9da"
NEXTAUTH_URL="http://localhost:3000"
GITHUB_SECRET_ID=NEXTAUTH_URL="http://localhost:3000"
NEXTAUTH_SECRET=7XMu1K3gXGmKaVKW02Lo4Z8Vi2kkcFfpQUmt2yHMgFg=
POSTGRES_URL="postgres://default:IQA2FonHJi9d@ep-square-union-29037633-pooler.us-east-1.postgres.vercel-storage.com:5432/verceldb"
POSTGRES_PRISMA_URL="postgres://default:IQA2FonHJi9d@ep-square-union-29037633-pooler.us-east-1.postgres.vercel-storage.com:5432/verceldb?pgbouncer=true&connect_timeout=15"

View File

@@ -1,10 +1,10 @@
import NextAuth from 'next-auth';
import NextAuth, { NextAuthOptions } from 'next-auth';
import CredentialsProvider from 'next-auth/providers/credentials';
import bcrypt from 'bcrypt';
import { fetchUser } from '../../../lib/data';
import { User } from '@/app/lib/definitions';
const authOptions = {
const authOptions: NextAuthOptions = {
providers: [
CredentialsProvider({
name: 'credentials',
@@ -42,7 +42,7 @@ const authOptions = {
},
secret: process.env.NEXTAUTH_SECRET,
pages: {
signIn: '/',
signIn: '/login',
},
};

View File

@@ -1,6 +1,7 @@
import './global.css';
import type { Metadata } from 'next';
import { Inter } from 'next/font/google';
import { AuthProvider } from './providers';
const inter = Inter({ subsets: ['latin'] });
@@ -16,7 +17,9 @@ export default function RootLayout({
}) {
return (
<html lang="en">
<body className={inter.className}>{children}</body>
<body className={inter.className}>
<AuthProvider>{children}</AuthProvider>
</body>
</html>
);
}

View File

@@ -0,0 +1,7 @@
'use client';
import { SessionProvider } from 'next-auth/react';
export const AuthProvider = ({ children }) => {
return <SessionProvider>{children}</SessionProvider>;
};

View File

@@ -1,3 +1,3 @@
export { default } from 'next-auth/middleware';
export const config = { matcher: ['/dashboard'] };
export const config = { matcher: ['/(dashboard.*)'] };