The federation protocols were designed with the idea that the application should just request an authentication, so that the signup concerns are handled either in a separate part of the application (perhaps using the user create endpoint of the Management API v2) or directly by the identity provider (like Auth0 does by offering a signup tab in Lock), but there’s no standard way for the application to tell the identity provider “show a signup UI”.
So, in general, the recommendation would be to avoid trying to do it. Do a regular authorize
request from the app, and let the UI handle the rest. Having said that, there’s a way to pass custom parameters in the authorize request and use them in the login page, with the following caveats:
- This parameters are not part of the OIDC protocol. It works now because of the way the HLP works now, but it might stop working in the future.
- Unless you pass
prompt=login
, there’s no guarantee that the hosted login page will be displayed at all.
You can do something like this:
auth0.WebAuth.authorize({
[...] // regular parameters
"action": "signup" // your custom parameter, could be any name
});
And then read the parameter from the HLP with config.extraParams
:
var isSignup = config.extraParams && config.extraParams.action === "signup";
var lock = new Auth0Lock(config.clientID, config.auth0Domain, {
[...] // all other Lock options
// use the value obtained to decide the first screen
initialScreen: isSignup ? "signUp" : "login",