Hi auth0 team, thank you for provide such as wonderful product.
While continue providing good experienced to users I got an issue need your aid as I describe below.
My application are host for multiple websites, each website will have its own auth0 configuration.
Currently I use nextjs version 14.2.35, nextjs-auth0 version 3.5.0, which I can create api such as: /login, /callback, /logout, /me, …
Example for /login:
import { getReturnToUrl } from '@/packages/constant/application_meta_data';
import Auth0Instance from '@/packages/constant/auth0_factory';
import { headers } from 'next/headers';
import { NextResponse } from 'next/server';
export async function GET(req: any, res: any) {
const host = headers().get('host') ?? '';
const authInstance = Auth0Instance(host);
const returnTo = getReturnToUrl(host);
try {
const response = await authInstance.handleLogin(req, res, {
authorizationParams: {
scope: 'openid offline_access email profile',
prompt: 'login',
},
returnTo: returnTo,
});
return response;
} catch (error: any) {
return NextResponse.json(
{ message: error.message },
{ status: error.status || 400 },
);
}
}
authInstance is Auth0Server import from @auth0/nextjs-auth0 .
I want to upgrade mine nextjs-auth0 version to newest which is v4.16.2 but when I do, the function handleLogin, handleLogout, handleProfile, … are not exposed to public and all the route need to be injected via proxy or middleware.
So If I do the upgrade I will lost ability to host multiple websites with different configuration, but If I don’t I won’t able to use newest features like Custom Token Exchange.
Please take a look when you’re available.
Best regard,
Trung Tran