I’m trying to accomplish what the question linked below is doing, but from the auth-spa-js framework.
Customizing the universal login widget is straightforward, but when I try to use it from loginWithRedirect(), I can’t figure out how to send a custom parameter the way that you can with WebAuth (by passing { mode: ‘signUp’ | ‘login’ } as an option).
Turns out it was super easy - I can pass any extra parameters to loginWithRedirect and they will end up on the authorize URL string as url-encoded parameters.
loginWithRedirect({ mode: 'signUp' });
…and in the custom login page:
// retrieve screen mode from extra params if sent; default to 'login'
var mode = config.extraParams.mode || 'login';
...
var lock = new Auth0Lock(config.clientID, config.auth0Domain, {
auth: {
// ...
},
// add a selector for which screen to put up
initialScreen: mode,
});