im using @auth0/nextjs-auth0/server and everything works correctly but when trying to set up a param for the actions in auth0. Ive tried doing:
in custom api/auth0/register route
// src/app/api/auth0/login/route.ts
import { auth0 } from '@/lib/services/auth0';
import { NextRequest } from 'next/server';
export async function GET(request: NextRequest) {
const origin = request.nextUrl.origin;
// const partner = request.nextUrl.searchParams.get('partner') ?? 'my pepe';
const partner = 'testttttt';
const internalAuth0 = auth0(origin);
return internalAuth0.startInteractiveLogin({
authorizationParameters: {
screen_hint: 'signup',
partner,
},
});
}
in built in auth0 route
/auth/login?screen_hint=signup&partner=exampleTestPartner
but neither of them works when logging the partner in my actions
/**
* Handler that will be called during the execution of a PreUserRegistration flow.
*
* @param {Event} event - Details about the context and user that is attempting to register.
* @param {PreUserRegistrationAPI} api - Interface whose methods can be used to change the behavior of the signup.
*/
exports.onExecutePreUserRegistration = async (event, api) => {
const partner = event.request?.query?.partner;
console.log('๐ partner from query:', partner);
console.log('๐งพ full request query:', event.request?.query);
console.log('event', event)
console.log('api', api)
if (partner) {
api.user.setUserMetadata("partner", partner);
}
};
it only logs undefined for event.request?.query
and partner
in the monitors in both cases. How can I make this work? Im using Nextjs server with client
this is my auth0 setup
import { Auth0Client } from '@auth0/nextjs-auth0/server';
export const auth0 = (baseUrl: string) => {
return new Auth0Client({
domain: process.env.AUTH0_CUSTOM_DOMAIN,
clientId: process.env.AUTH0_CLIENT_ID!,
clientSecret: process.env.AUTH0_CLIENT_SECRET!,
appBaseUrl: baseUrl,
secret: process.env.AUTH0_SECRET!,
});
};