Set the 'realm' value in Lock (Universal Login)

Hi there,

I have a .net core application that uses an Auth0 Universal Login with a custom database Connection.

The application is setup to include an extra parameter realm when redirecting to the Universal Login page, e.g., ?realm=foo. Therefore, this value is available in the Universal Login script via config.extraParams.realm - all good.

My question is, how am I able to pass the value of config.extraParams.realm to the custom db connection’s action script when using Lock?

There is a topic here that appears to have a solution for a custom login page (no Lock) using webAuth.login, but I’m trying to find the solution for when using Lock if possible. I’ve scoured the docs/forums and tested a fair bit but can’t see an obvious way.

As per the suggestion in the topic I mentioned above, I’ve updated my connection so I can add context to my function in the connection’s action script, i.e.,

function login(email, password, context, callback) {...}

And while debugging I can see context.realm is available, I just need to be able to set it during login (like you can with webAuth.login). Anyone have any ideas about how to do this, or even send any custom value to the db connection script from a Universal Login that uses Lock?

Any light shed would be very much appreciated (still very much an Auth0 newbie). Thanks.

For setting up stuff dynamically, I think you can use events for that, something like:

lock.on("signin submit", function() {<stuff>});

More details here: Lock API Reference

The problem remains with sending data in the context object under the custom DB login script, which I couldn’t find so far. It feels like just the realm is sent there and overridden by the auth logic.