I have a very similar challenge to Pass parameters into Auth0 sign up. However, the answers to that question are all outdated and point to Auth0 functionality that is end-of-life.
I have a B2C application with an owner role and a contributor role. When a user registers, I need to indicate to Auth0 which type of role they are registering for. Then I would like to use Auth0 Actions to do the Role Assignment.
If I have to use the Management API from my application, then that is already too late, as the Auth token has been created, and they won't have a role assigned until their token is refreshed.
This can be done with the AuthorizationParams
class in auth0-spa-js lib.
If, like me, you are using Blazor. Then you need to do it like so:
var parameters = new Dictionary<string, object>
{
{"ext-user-type", "Example"}
};
var options = new InteractiveRequestOptions
{
Interaction = InteractionType.SignIn,
ReturnUrl = Navigation.Uri
};
options.TryAddAdditionalParameter("extraQueryParams", parameters);
Navigation.NavigateToLogin("authentication/login", options);
You can then grab this in the Post Login Action in the event.request.query
object.