Hi,
I’m trying a simple authentication with a different route path, in nextjs
my layout.ts
import { UserProvider } from "@auth0/nextjs-auth0/client";
import type { Metadata } from "next";
import { Inter } from "next/font/google";
import "./globals.css";
const inter = Inter({ subsets: ["latin"] });
export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
};
export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en">
<UserProvider>
<body className={inter.className}>{children}</body>
</UserProvider>
</html>
);
}
page.ts
import { getSession } from "@auth0/nextjs-auth0";
export default async function Home() {
const { user } = await getSession();
console.log(user);
return (
<main className="flex min-h-screen flex-col items-center justify-between p-24">
<a href="/auth/api/login">Login</a>
{user && (
<div>
<img src={user.picture} alt={user.name} />
<h2>{user.name}</h2>
<p>{user.email}</p>
</div>
)}
</main>
);
}
.env.local
AUTH0_SECRET=
AUTH0_BASE_URL='http://localhost:3000'
AUTH0_ISSUER_BASE_URL=
AUTH0_CLIENT_ID=
AUTH0_CLIENT_SECRET=''
AUTH0_CALLBACK='/auth/api/callback'
so, instead use default /api/auth/...
im using /auth/api/...
. everything is working fine. except that when I’ loading the page, there’s some calling to the default me route and I’m not sure where it is coming from