No valid session after successful login using Next.js sdk

I am writing a Next.js app using the Auth0 sdk. I followed the steps from the quickstart.

My problem is that getSession() is returning null in the login callback after a successful login. getAccessToken is throwing an AccessTokenError: The user does not have a valid session. I have checked in the auth0 user logs and they show that every login is indeed successful.

Here is the code for the callback

 import { getSession, getAccessToken } from '@auth0/nextjs-auth0';
 import { redirect } from 'next/navigation'
 const page = async function LoginCallback() {
     const session = await getSession(); //null
     const { accessToken } = await getAccessToken(); //AccessTokenError
     console.log("login callback")
 export default page

I have wrapped my layout with the UserProvider

  export default async function RootLayout({
 }: Readonly<{
   children: React.ReactNode;
 }>) {
   return (
     <html lang="en">
         <body className={inter.className}>
             <ThemeProvider theme={theme}>

At this point I’m at a loss for how to go about diagnosing this problem. Is there anyway to turn on verbose logging on the client side?

Thank you for your time

Did you find a solution? I’m running into a similar problem…