Sending extra params with loginWithRedirect (auth0-js-spa)

I’ve seen a few posts asking about being able to send parameters over the signup that can be used in Actions and/or Rules and a lot of them reference using custom domains but I am trying to get it to work without custom domains.

Scenario:
We want to be able to distinguish between a “business” and an “individual” signup so our intention is to use the loginWithRedirect with an extra parameter to be able to distinguish between the two.

authClient.loginWithRedirect({
  screen_hint: 'signup',
  extraParam: 'foo'
});

We have a pre-registration action that is looking putting the entire event into the app_metadata in order that we can see the query

exports.onExecutePreUserRegistration = async (event, api) => {
  api.user.setAppMetadata('event', event);
};

Once the user has signed up we can see the entire event in the app_metadata but no sign of the extraParam. Any ideas what we might be doing wrong?

event.request.query (which is where those extra params will be) is not available in the pre-registration action. It is available in a post-login action if you can use that instead.

2 Likes

Yep, we literally just figured this out… typical!

Although I will say that it did not occur to me that they would not be available in pre-registration or indeed post-registration which is why it was bugging me that it was not working. There might be something that can be improved in the documentation here or I may have looked past it.

Thanks for the response, really appreciate it.

1 Like

Teamwork makes the dreamwork!