pj2025
March 3, 2025, 4:20am
1
In my nextjs app, and inside “\src\app\api\auth[…auth0]\route.ts”
I’m importing handle auth from nextjs-auth0 sdk but it gives error of no exported member.
import { handleAuth } from ‘@auth0 /nextjs-auth0’;
the sdk is installed and the version is ^4.0.2.
“dependencies”: {
“@auth0 /nextjs-auth0”: “^4.0.2”,
Am I doing something wrong?
pj2025
March 3, 2025, 3:09pm
2
My nextjs version is also latest, all the dependencies are latest ones.
pj2025
March 5, 2025, 4:52am
4
Can anyone help please? I’m trying but there is no clear docs update that handleAuth is not supported. I even tried to create a new nextjs app just to check but same error: Module ‘“@auth0 /nextjs-auth0”’ has no exported member ‘handleAuth’.
have the same issue, so sadly don’t have a solution yet. Gemini has some other recommendations, but throw same error
I deleted route.ts
and it worked
pj2025
March 7, 2025, 1:36pm
7
instead route.ts
using lib/auth0.ts works
import { Auth0Client } from “@auth0 /nextjs-auth0/server”
export const auth0 = new Auth0Client();
and a middleware.ts
pj2025
March 7, 2025, 1:37pm
8
but my setup is different so i won’t be using middleware.ts here
Ibkdir
March 29, 2025, 6:04am
9
In the latest version, the auth0/nextjs-auth0 github specifies that the SDK automatically mounts the main authentication-related routes:
import { Auth0Client } from "@auth0/nextjs-auth0/server"
export const auth0 = new Auth0Client()
The following routes are automatically mounted:
/auth/login
/auth/logout
/auth/callback
/auth/profile
/auth/access-token
/auth/backchannel-logout