Auth0 actions not receiving param

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!,
  });
};

Hi @camilo.mafioly

Welcome to the Auth0 Community!

Unfortunately, there is no out-of-the-box solution to pass parameters as additional query parameters in order to be accessible in an PreUserRegistration Action as mentioned in this knowledge article.

You could attempt a potential workaround by adding a hidden input using prompts mentioned in this community post.

If you have any other questions, let me know!

Kind Regards,
Nik

Thanks a lot for your fast response. This is really helpful but just 1 question, where do i create this input? Is there an option in auth0 for this?

im using an a tag for now

  <a
        href="/auth/login?screen_hint=signup"
      >

This can be used in the new universal login or the custom one?

You will need to add a custom prompt under one of the available page templates under Branding โ†’ Universal Login โ†’ Advanced

These custom page templates are using the Universal Login.

Kind Regards,
Nik

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.