auth0 v2 uses pages router not app router. building correctly now

This commit is contained in:
Genuinely 2025-03-24 15:40:14 -07:00
parent 39c8eef888
commit e7ff02f1b8
6 changed files with 1519 additions and 1182 deletions

View file

@ -14,6 +14,8 @@ services:
build:
context: .
dockerfile: app.dockerfile
env_file:
- .env # env variables for auth0
environment:
- SEARXNG_API_URL=http://searxng:8080
ports:

View file

@ -1,2 +1,5 @@
### Adding auth0
use `yard add` for new packages and the packages will be updated automatically
* use `yard add` for new packages and the packages will be updated automatically
* auth-secret generate with `openssl rand -hex 32`
* need to no-cache if updating packages...don't need to remove `--frozen-lockfile` can be handled with `yarn`
* version 2 is using

View file

@ -12,7 +12,7 @@
"db:push": "drizzle-kit push"
},
"dependencies": {
"@auth0/nextjs-auth0": "^4.2.1",
"@auth0/nextjs-auth0": "^2",
"@headlessui/react": "^2.2.0",
"@iarna/toml": "^2.2.5",
"@icons-pack/react-simple-icons": "^12.3.0",

View file

@ -0,0 +1,4 @@
// pages/api/auth/[...auth0].ts
import { handleAuth } from '@auth0/nextjs-auth0';
export default handleAuth();

View file

@ -5,6 +5,7 @@ import { cn } from '@/lib/utils';
import Sidebar from '@/components/Sidebar';
import { Toaster } from 'sonner';
import ThemeProvider from '@/components/theme/Provider';
import { UserProvider } from '@auth0/nextjs-auth0/client'; // ✅ Auth0 wrapper
const montserrat = Montserrat({
weight: ['300', '400', '500', '700'],
@ -27,18 +28,20 @@ export default function RootLayout({
return (
<html className="h-full" lang="en" suppressHydrationWarning>
<body className={cn('h-full', montserrat.className)}>
<ThemeProvider>
<Sidebar>{children}</Sidebar>
<Toaster
toastOptions={{
unstyled: true,
classNames: {
toast:
'bg-light-primary dark:bg-dark-secondary dark:text-white/70 text-black-70 rounded-lg p-4 flex flex-row items-center space-x-2',
},
}}
/>
</ThemeProvider>
<UserProvider> {/* ✅ Wrap app in Auth0 context */}
<ThemeProvider>
<Sidebar>{children}</Sidebar>
<Toaster
toastOptions={{
unstyled: true,
classNames: {
toast:
'bg-light-primary dark:bg-dark-secondary dark:text-white/70 text-black-70 rounded-lg p-4 flex flex-row items-center space-x-2',
},
}}
/>
</ThemeProvider>
</UserProvider>
</body>
</html>
);

2659
yarn.lock

File diff suppressed because it is too large Load diff