mirror of
https://github.com/vercel/next-learn.git
synced 2026-06-11 09:51:47 +00:00
re-add providers lol. also add all dashboard paths to middleware
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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',
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -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>
|
||||
);
|
||||
}
|
||||
|
||||
7
dashboard/15-final/app/providers.tsx
Normal file
7
dashboard/15-final/app/providers.tsx
Normal file
@@ -0,0 +1,7 @@
|
||||
'use client';
|
||||
|
||||
import { SessionProvider } from 'next-auth/react';
|
||||
|
||||
export const AuthProvider = ({ children }) => {
|
||||
return <SessionProvider>{children}</SessionProvider>;
|
||||
};
|
||||
@@ -1,3 +1,3 @@
|
||||
export { default } from 'next-auth/middleware';
|
||||
|
||||
export const config = { matcher: ['/dashboard'] };
|
||||
export const config = { matcher: ['/(dashboard.*)'] };
|
||||
|
||||
Reference in New Issue
Block a user