Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3 Beta #1235

Closed
adamjmcgrath opened this issue Jun 8, 2023 · 46 comments
Closed

v3 Beta #1235

adamjmcgrath opened this issue Jun 8, 2023 · 46 comments
Labels
guidance A question about usage/best-practices

Comments

@adamjmcgrath
Copy link
Contributor

adamjmcgrath commented Jun 8, 2023

v3 of this SDK is now available on Beta.

The main update is support for Next.js 13.4's App Router

Edit: https://github.com/auth0/nextjs-auth0/releases/tag/v3.0.0-beta.3 adds full support for the Edge runtime

To install:

$ npm i @auth0/nextjs-auth0@beta

For more information about how to use the SDK in the app directory, see these resources:

If you notice any problems, please raise a new issue with the beta label

@tomsseisums
Copy link

Would using the middleware automatically refresh tokens?

@lostinpatterns
Copy link

Thanks for shipping this update! 🎉 Just to follow up on what Tom said, it'd be great to get some guidance/workarounds on ways to mitigate those limitations. Seeing as the App Router is the future of next.js, it's safe to assume most people will move to adopt it and certainly new projects will be built on it by default. If they also want to adopt Auth0, the question then is how to make that work.

In our case, we refresh our access tokens, so it'd be great to know how to work around this so that we aren't refreshing on every server page render once the access token has expired (which is what sounds like will happen). If the answer to @tomsseisums question is yes then we'd be happy to deploy that as a solution!

@adamjmcgrath
Copy link
Contributor Author

Hi @lostinpatterns @tomsseisums

To mitigate the issue of a rolling session not being updated in server components, I would recommend using withMiddlewareAuthRequired

To mitigate the issue with ATs not being refreshed, I would recommend using route handlers to get access token's and access 3rd party APIs.

This should cover the majority of use cases.

We don't support refreshing ATs on the edge yet - we have a different issue open for that #912 - I can't tell you when we might be able to prioritise work for this.

@jalvarado91
Copy link

jalvarado91 commented Jun 9, 2023

Thank you for the swift beta release. I have one comment, I can open a separate issue if needed:

The example app in the repo sets up middleware which is what I'd prefer to use, however the example app seems to be using both pages and app dir, and points the middleware initialization to the pages router version of the login. At first glance I thought I was supposed to use both pages and app /api/auth/[auth0] handlers to get the middleware to work. Would be nice to have an app router only example.

Edit: Opened an issue I'm encountering using the beta in a fresh app here

@adamjmcgrath
Copy link
Contributor Author

@jalvarado91 - see #1218 (comment)

@danlutz
Copy link

danlutz commented Jun 10, 2023

Great work on the beta!
Will it be possible to use both pages and app router, both using auth0 and the respective api route?

@lewisking
Copy link

lewisking commented Jun 12, 2023

Thanks of the work on the beta. However, I get 500 errors whenever I visit any auth route after setting up the route.js file in the correct place. Any ideas how I can debug? I can't even get anything logging in console. I have duplicated the example repo and get exactly the same issue.

@ZainChen
Copy link

I'd like to ask when v3 is expected to be released, I'm using the Beta version and the convenience of getting the AccessToken in the server component is a particularly useful feature for me.

@adamjmcgrath
Copy link
Contributor Author

adamjmcgrath commented Jun 12, 2023

Will it be possible to use both pages and app router, both using auth0 and the respective api route?

@danlutz, yes - the example app uses both the app router and the page router

I get 500 errors whenever I visit any auth route after setting up the route.js file in the correct place. Any ideas how I can debug?

@lewisking - the SDK should log errors to the console by default. If you're not even getting those you must have a more fundamental issue. Raise a new gh issue and share a reproducible example and I'd be happy to investigate.

I'd like to ask when v3 is expected to be released

@ZainChen (and to any future questions about release timing) - I can't give you a release date, but it will be at least 2 - 3 weeks away.

@muresan-raul
Copy link

muresan-raul commented Jun 12, 2023

I'm having the same issue as @lewisking:
500-ise
useFetcher
fetcherURL

Can be reproduced with npx create-next-app@latest and the basic setup for @auth0/nextjs-auth0@beta

@lewisking
Copy link

@adamjmcgrath thanks Adam, was going to create one but just seen @jalvarado91 has created one in the meantime. Let's track the issues there as it's exactly what I'm getting.

@lgariv
Copy link

lgariv commented Jun 13, 2023

Works beautifully with my next 13.4.5 project! Haven't noticed any bugs yet, will report if I will

@DotCoyote
Copy link

Same here, server-components work like a charm! How do I get the accessToken from a client-component now, though? 🙈
Do I need to pass it down from the server?

Background: I want to connect to an external API with a Bearer token from auth0. Do I need to create proxy-routes now?

@adamjmcgrath
Copy link
Contributor Author

@DotCoyote - see #358 (comment)

@ColemanDunn
Copy link

Does anyone have any info on how to refresh the session.user from useUser()? When I update a user's role (from the api or the dashboard, wherever) it is not reflected in the session.user object. We used to have a custom handler in handleAuth (with the old req and res) that would do it but now I can't seem to get it working with app directory. I feel like there has got to be an easier way to simply update the user object than making a custom handler. Anyone have some insight?

@lewisking
Copy link

Can I use getSession in middleware? I get the following error:

`Server Error
TypeError: Cannot read properties of undefined (reading 'substring')

This error happened while generating the page. Any console logs will be displayed in the terminal window.
Call Stack

node_modules/oidc-token-hash/lib/shake256.js (3:0)
substring
node_modules/oidc-token-hash/lib/shake256.js (3:39)`

@brunoscopelliti
Copy link

@lewisking See this one: #1247

@brunoscopelliti
Copy link

Hi @adamjmcgrath

Could you please give an example of how to use updateSession?
This is what I've tried:

export const GET = withApiAuthRequired(
  async (request: NextRequest, _context: RouteContext) => {
    try {
      const session = await getSession();

      const response = NextResponse.redirect(new URL("/destination", request.url));

      await updateSession(request, response, { ...session, user: { ...session?.user, name: "UPDATED" } });

      return response;
    } catch (error: any) {
      // Handle error
    }
  }
);

But it doesn't seem to work; the redirect happens, but the session is unchanged.

@adamjmcgrath
Copy link
Contributor Author

@brunoscopelliti - thanks for raising that

Your example should work, but there's an issue with withApiAuthRequired overwriting the "appSession" cookie (if you remove withApiAuthRequired your example will work)

I'll raise some work to fix this in the next Beta update

@BRGustavoRibeiro
Copy link

Hi everyone! I apologize in advance if this isn't the appropriate place to post my question.

I'm currently working on a new project using Next.js and I'm trying to implement both Auth0 SDK and next-intl simultaneously. However, I've encountered an issue where both libraries require exporting something in the middleware. I need to incorporate Auth0 into the middleware to protect all routes.

I've made several attempts, but I haven't been successful in getting both libraries to work together.

Here's the code that next-intl needs to export:

export default createMiddleware({
  locales: ["pt-br"],
  defaultLocale: "pt-br",
});

export const config = {
  matcher: ["/((?!api|_next|.*\\..*).*)"],
};

And here's the code that Auth0 needs to export in order to protect all routes:

import { withMiddlewareAuthRequired } from '@auth0/nextjs-auth0/edge';

export default withMiddlewareAuthRequired();

Could someone please assist me with this? I'm genuinely confused and unsure about how to proceed from this point.

@lewisking
Copy link

@lewisking See this one: #1247

Thanks man! Works great.

@paleloser
Copy link

paleloser commented Jun 30, 2023

Hey there. First and foremost thank you for maintaining this awesome library.

I used to have the following configuration in the api handler with the pages router:

import { handleAuth, handleCallback, handleLogin } from '@auth0/nextjs-auth0';

export default handleAuth({
  callback: handleCallback({ 
    afterCallback: async (req, res, session, state) => {
      if (session.user) {
        // In production this part is done by the Auth0 post-registration action
        if (process.env.ENV && process.env.ENV === 'local') {
          try {
            await fetch(`${process.env.API_ENDPOINT}/signup`, {
              method: 'POST',
              headers: {
                Authorization: `Bearer ${session.accessToken}`,
                'Content-Type': 'application/json'
              },
              body: JSON.stringify({
                idpId: session.user.sub,
                email: session.user.email
              })
            })
          } catch (e) {
            console.error(`Unexpected error registering user: ${e}`)
          }
        }

        if (session.user.email === session.user.name) {
          state.returnTo = process.env.AUTH0_BASE_URL + '/profile'
        }
      }
      return session;
    }
  }),
  login: handleLogin({
    authorizationParams: {
      audience: process.env.API_ENDPOINT,
      scope: 'openid email profile offline_access'
    }
  })
});

By using the afterCallback, I emulated a post-user-registration action locally (in conjunction with ENV=local) that helped me to firstly register users in my database as they logged in for the first time and secondly redirect them to their profile page (so they could configure other stuff in their profiles).

Apparently, with the new beta this no longer works (app router), and I get the following after login:

  • On the client side (browser): ERR_TOO_MANY_REDIRECTS, URL: http://localhost:3000/api/auth/callback?code=...&state=...
  • On the server side (npm console):
Request error: AccessTokenError: The user does not have a valid access token.
Request error: AccessTokenError: The user does not have a valid access token.
Request error: AccessTokenError: The user does not have a valid access token.
Request error: AccessTokenError: The user does not have a valid access token.
CallbackHandlerError: Callback handler failed. CAUSE: Missing state cookie from login request (check login URL, callback URL and cookie config).
    at eval (webpack-internal:///(sc_server)/./node_modules/@auth0/nextjs-auth0/dist/handlers/callback.js:51:19)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async eval (webpack-internal:///(sc_server)/./node_modules/@auth0/nextjs-auth0/dist/handlers/auth.js:59:24)
    at async eval (webpack-internal:///(sc_server)/./node_modules/next/dist/server/future/route-modules/app-route/module.js:265:37) {
  code: 'ERR_CALLBACK_HANDLER_FAILURE',
  cause: MissingStateCookieError: Missing state cookie from login request (check login URL, callback URL and cookie config).
      at eval (webpack-internal:///(sc_server)/./node_modules/@auth0/nextjs-auth0/dist/auth0-session/handlers/callback.js:18:19)
      at runMicrotasks (<anonymous>)
      at processTicksAndRejections (node:internal/process/task_queues:96:5)
      at async eval (webpack-internal:///(sc_server)/./node_modules/@auth0/nextjs-auth0/dist/handlers/callback.js:48:13)
      at async eval (webpack-internal:///(sc_server)/./node_modules/@auth0/nextjs-auth0/dist/handlers/auth.js:59:24)
      at async eval (webpack-internal:///(sc_server)/./node_modules/next/dist/server/future/route-modules/app-route/module.js:265:37) {
    status: 400,
    statusCode: 400
  },
  status: 400
}

Not blocking us though, I'm just commenting this in case it helps.

Thanks in advance!

@paleloser
Copy link

Also, in regards with this new release, I think it may worth adding an example of authenticating all pages below a given layout (so users don't need to place the withPageAuthRequired in every page). Here's what we're using

root layout

import '@/styles/globals.css'
import { Inter } from 'next/font/google';
 
const inter = Inter({
  subsets: ['latin'],
  variable: '--font-inter',
})

export default function Layout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="es">
      <head>
        <link rel="shortcut icon" href="/icon.svg" type="image/svg+xml"></link>
      </head>
      <body className={`${inter.variable} font-sans min-h-screen`}>
        {children}
      </body>
    </html> 
  )
}

authenticated pages layout

import { UserProvider } from "@auth0/nextjs-auth0/client";
import { withPageAuthRequired } from "@auth0/nextjs-auth0";

export default withPageAuthRequired(
  async function Layout({ children }: any) {
    return (
      <UserProvider>
        <main className={`flex flex-col justify-start items-center`}>{children}</main>
      </UserProvider>
    )
  }
)

@asalcedo-ci
Copy link

Hi, do we have a timeline on when v3 will be safe for production?

@adamjmcgrath
Copy link
Contributor Author

@asalcedo-ci - we're planning to release v3 by EO July

@m-torin
Copy link

m-torin commented Jul 10, 2023

Anyone else seeing a TypeError: "secret" is required error on build in the example app?

info Collecting page data ...TypeError: "secret" is required
    at get (/Users/~/example-app/.next/server/chunks/107.js:358:15)
    at getConfig (/Users/~/example-app/.next/server/chunks/107.js:1637:45)
    at getInstance (/Users/~/example-app/.next/server/chunks/107.js:2690:63)
    at handleAuth (/Users/~/example-app/.next/server/chunks/107.js:2737:31)
    at 472 (/Users/~/example-app/.next/server/app/api/auth/[auth0]/route.js:153:32)
    at __webpack_require__ (/Users/~/example-app/.next/server/webpack-runtime.js:25:42)
    at __webpack_exec__ (/Users/~/example-app/.next/server/app/api/auth/[auth0]/route.js:196:39)
    at /Users/~/example-app/.next/server/app/api/auth/[auth0]/route.js:197:81
    at __webpack_require__.X (/Users/~/example-app/.next/server/webpack-runtime.js:138:21)
    at /Users/~/example-app/.next/server/app/api/auth/[auth0]/route.js:197:47

> Build error occurred
Error: Failed to collect page data for /api/auth/[auth0]
    at /Users/~/example-app/node_modules/next/dist/build/utils.js:1161:15
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  type: 'Error'
}

@milosjovancevic
Copy link

milosjovancevic commented Jul 10, 2023

@m-torin
I am also experiencing this issue when deploying on Heroku, build works just fine locally 😅

EDIT. Disregard what I said below ⬇️, that is not the solution 😕

I think I stumbled upon this and fix for me was to add
AUTH0_SECRET=DGhgf/HaKKpMmhPIN68PqL01qUQCkH+8hvSaCA360x4= (random long string) to .env.local

@dlibis
Copy link

dlibis commented Jul 11, 2023

Im having this error: Error: Dynamic server usage: cookies, when using this on a server page (app/page.tsx)

import { getSession } from '@auth0/nextjs-auth0';
export default async function Home() {
  const session = await getSession();
  return <div className="container">{session?.accessToken}</div>;
}

@ZainChen
Copy link

ZainChen commented Jul 12, 2023

I have a problem.
appSession is another user or has been modified.
page.tsx In the server component, writing to the content in the image reports an error when the page is refreshed.
It is normal to use this writeup in client-side components: import { withPageAuthRequired } from '@auth0/nextjs-auth0/client';
image

@dearrolloruntim3
Copy link

I found an issue with typescript

My page component is like this:

import { withPageAuthRequired } from "@auth0/nextjs-auth0";

async function Page({ params }: { params?: { id: string } }) {
  return <span>My page</span>;
}

// @ts-ignore
export default withPageAuthRequired(Page, { returnTo: "/" });

It will throw an error because withPageAuthRequired expects the component with params having only the slug field, it doesn't accept any other kind of fields, which is incorrect.

In this examples https://nextjs.org/docs/app/building-your-application/routing/dynamic-routes#typescript it says we can accept whatever we want for the route segments, not only slug.

@phiperomega
Copy link

I've also got the same issue in azure where the env variables is not present at build time. Worked previously with 2.6.0 but not with 3.0.0-beta.3

Anyone else seeing a TypeError: "secret" is required error on build in the example app?
....

@adamjmcgrath
Copy link
Contributor Author

@m-torin @milosjovancevic @phiperomega

in the App Directory, Next.js is attempting to statically render the auth handlers (the auth handlers instantiate the SDK which requires the secret config). I think this is a bug in Next.js (reported here vercel/next.js#45348) because the auth handlers use the cookies() dynamic function and should therefore not be opted in for static rendering (per https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic-rendering#dynamic-rendering)

If you can't provide those env vars at build time, you should use the dynamic route segment config to explicitly tell Next.js not to statically render that route. eg

// /app/api/auth/[auth0]/route.ts
import { handleAuth } from '@auth0/nextjs-auth0';

export const GET = handleAuth();

export const dynamic = 'force-dynamic'

@dearrolloruntim3 I'll fix the types shortly

@ZainChen I don't understand your problem. Please raise a separate issue with an example repo that demonstrates your problem if you want me to investigate.

@john-e-riordan
Copy link

I've also got the same issue in azure where the env variables is not present at build time. Worked previously with 2.6.0 but not with 3.0.0-beta.3

Anyone else seeing a TypeError: "secret" is required error on build in the example app?
....

I was getting this was apparently able to address it by adding an .env file with dummy values which is NOT in my .gitignore. The routes get built as λ (Server) server-side renders at runtime in the output. Injecting environment variables with "real" values at runtime seems to work. I just got it working and only tested it twice, so maybe I'm imagining it now working (but done looking at this today).

Here is my .env

# The base url of your application
AUTH0_BASE_URL=http://localhost:3000
# The url of your Auth0 tenant domain
AUTH0_ISSUER_BASE_URL=https://YOUR_AUTH0_DOMAIN.auth0.com
# Your Auth0 application's Client ID
AUTH0_CLIENT_ID=YOUR_AUTH0_CLIENT_ID
# Your Auth0 application's Client Secret
AUTH0_CLIENT_SECRET=YOUR_AUTH0_CLIENT_SECRET
# A long, secret value used to encrypt the session cookie
AUTH0_SECRET=LONG_RANDOM_VALUE

@phiperomega
Copy link

Thanks for the response @adamjmcgrath ! Unfortunately the export const dynamic didn't work for me, produces the same error. I'm currently looking at adding the env variables at build time.

@michaelschufi
Copy link

First of all, thank you for the work on the update. We're excited to use it soon :D

  • How stable/secure is this version at the moment? Especially when it comes to checking the login-state with "getSession" inside a server component.
  • Is the beta version stable if only used with the pages router?

I'm asking because we're incrementally adopting the app router and will only need the new getSession in production in September.

@niksimFS24
Copy link

niksimFS24 commented Jul 25, 2023

Anyone have an idea what could cause this error? Auth flow works well in local but not in PR env. We are providing AUTH0_SECRET and AUTH0_CLIENT_SECRET on runtime as well through Rancher.

When we type email and pass and hit login button this error occurs, in callback.

- ready started server on 0.0.0.0:80, url: http://localhost:80
CallbackHandlerError: Callback handler failed. CAUSE: invalid_grant (Invalid authorization code)
    at /home/node/app/.next/server/chunks/514.js:1859:19
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async /home/node/app/.next/server/chunks/514.js:1762:24
    at async /home/node/app/.next/server/chunks/876.js:5172:37 {
  code: 'ERR_CALLBACK_HANDLER_FAILURE',
  cause: IdentityProviderError: invalid_grant (Invalid authorization code)
      at NodeClient.callback (/home/node/app/.next/server/chunks/514.js:160:23)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async /home/node/app/.next/server/chunks/514.js:409:29
      at async /home/node/app/.next/server/chunks/514.js:1856:13
      at async /home/node/app/.next/server/chunks/514.js:1762:24
      at async /home/node/app/.next/server/chunks/876.js:5172:37 {
    error: 'invalid_grant',
    errorDescription: 'Invalid authorization code',
    status: 400,
    statusCode: 400,
    openIdState: {
      returnTo: 'this is our app domain here, just edited it :)'
    }
  },
  status: 400
}

@aganglada
Copy link

aganglada commented Jul 25, 2023

Anyone else seeing a TypeError: "secret" is required error on build in the example app?

info Collecting page data ...TypeError: "secret" is required
    at get (/Users/~/example-app/.next/server/chunks/107.js:358:15)
    at getConfig (/Users/~/example-app/.next/server/chunks/107.js:1637:45)
    at getInstance (/Users/~/example-app/.next/server/chunks/107.js:2690:63)
    at handleAuth (/Users/~/example-app/.next/server/chunks/107.js:2737:31)
    at 472 (/Users/~/example-app/.next/server/app/api/auth/[auth0]/route.js:153:32)
    at __webpack_require__ (/Users/~/example-app/.next/server/webpack-runtime.js:25:42)
    at __webpack_exec__ (/Users/~/example-app/.next/server/app/api/auth/[auth0]/route.js:196:39)
    at /Users/~/example-app/.next/server/app/api/auth/[auth0]/route.js:197:81
    at __webpack_require__.X (/Users/~/example-app/.next/server/webpack-runtime.js:138:21)
    at /Users/~/example-app/.next/server/app/api/auth/[auth0]/route.js:197:47

> Build error occurred
Error: Failed to collect page data for /api/auth/[auth0]
    at /Users/~/example-app/node_modules/next/dist/build/utils.js:1161:15
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  type: 'Error'
}

Seems like the issue is, the new api routes cannot access env variables right?

vercel/next.js#50759

We will want an alternative for this to work on the v3

@adamjmcgrath
Copy link
Contributor Author

👋 v3 is now Generally Available https://github.com/auth0/nextjs-auth0/releases/tag/v3.0.0

If you notice any problems, please raise a new issue

@topaxi
Copy link

topaxi commented Jul 26, 2023

If anyone in the future ever runs into the issue @niksimFS24 described above.

We had to increase our buffer proxy size in nginx of our k8s ingress with these two annotations:

'nginx.ingress.kubernetes.io/proxy-buffer-size': '16k',
'nginx.ingress.kubernetes.io/server-snippet': 'client_header_buffer_size 16k; large_client_header_buffers 4 32k;'

@zeelmodi-simform
Copy link

@adamjmcgrath I'm getting following error when I try to redirect to login page

LoginHandlerError: Login handler failed. CAUSE: Discovery requests failing for https://dev-6vy0mwhhwzruj0vb.us.auth0.com, outgoing request timed out after 5000ms at eval (webpack-internal:///(rsc)/./node_modules/@auth0/nextjs-auth0/dist/handlers/login.js:60:19) at async eval (webpack-internal:///(rsc)/./node_modules/@auth0/nextjs-auth0/dist/handlers/auth.js:59:24) at async eval (webpack-internal:///(rsc)/./node_modules/next/dist/server/future/route-modules/app-route/module.js:253:37) { code: 'ERR_LOGIN_HANDLER_FAILURE', cause: DiscoveryError: Discovery requests failing for https://dev-6vy0mwhhwzruj0vb.us.auth0.com, outgoing request timed out after 5000ms at NodeClient.getClient (webpack-internal:///(rsc)/./node_modules/@auth0/nextjs-auth0/dist/auth0-session/client/node-client.js:47:19) at async NodeClient.authorizationUrl (webpack-internal:///(rsc)/./node_modules/@auth0/nextjs-auth0/dist/auth0-session/client/node-client.js:114:24) at async eval (webpack-internal:///(rsc)/./node_modules/@auth0/nextjs-auth0/dist/auth0-session/handlers/login.js:73:34) at async eval (webpack-internal:///(rsc)/./node_modules/@auth0/nextjs-auth0/dist/handlers/login.js:57:13) at async eval (webpack-internal:///(rsc)/./node_modules/@auth0/nextjs-auth0/dist/handlers/auth.js:59:24) at async eval (webpack-internal:///(rsc)/./node_modules/next/dist/server/future/route-modules/app-route/module.js:253:37), status: undefined }

I'm currently on the free version of auth0 and also tried various ways to integrate it with my app. I tried it with both app and pages router but none of them seems to be working for me. Any help will be appreciated!

@joshua-lawrence
Copy link

@adamjmcgrath I'm getting following error when I try to redirect to login page

LoginHandlerError: Login handler failed. CAUSE: Discovery requests failing for https://dev-6vy0mwhhwzruj0vb.us.auth0.com, outgoing request timed out after 5000ms at eval (webpack-internal:///(rsc)/./node_modules/@auth0/nextjs-auth0/dist/handlers/login.js:60:19) at async eval (webpack-internal:///(rsc)/./node_modules/@auth0/nextjs-auth0/dist/handlers/auth.js:59:24) at async eval (webpack-internal:///(rsc)/./node_modules/next/dist/server/future/route-modules/app-route/module.js:253:37) { code: 'ERR_LOGIN_HANDLER_FAILURE', cause: DiscoveryError: Discovery requests failing for https://dev-6vy0mwhhwzruj0vb.us.auth0.com, outgoing request timed out after 5000ms at NodeClient.getClient (webpack-internal:///(rsc)/./node_modules/@auth0/nextjs-auth0/dist/auth0-session/client/node-client.js:47:19) at async NodeClient.authorizationUrl (webpack-internal:///(rsc)/./node_modules/@auth0/nextjs-auth0/dist/auth0-session/client/node-client.js:114:24) at async eval (webpack-internal:///(rsc)/./node_modules/@auth0/nextjs-auth0/dist/auth0-session/handlers/login.js:73:34) at async eval (webpack-internal:///(rsc)/./node_modules/@auth0/nextjs-auth0/dist/handlers/login.js:57:13) at async eval (webpack-internal:///(rsc)/./node_modules/@auth0/nextjs-auth0/dist/handlers/auth.js:59:24) at async eval (webpack-internal:///(rsc)/./node_modules/next/dist/server/future/route-modules/app-route/module.js:253:37), status: undefined }

I'm currently on the free version of auth0 and also tried various ways to integrate it with my app. I tried it with both app and pages router but none of them seems to be working for me. Any help will be appreciated!

Also encountering this issue with increasing frequency.

@Sivaranjith1
Copy link

@adamjmcgrath Is the Auth0 provider a server component now when using react sever components or is it a client component?

@adamjmcgrath
Copy link
Contributor Author

@Sivaranjith1 - it's a client component (React Context is not available on the server)

@auth0 auth0 locked as resolved and limited conversation to collaborators Aug 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
guidance A question about usage/best-practices
Projects
None yet
Development

No branches or pull requests