I want to make a web request (an ajax request) before the initialization of lock screen. Means I want to fetch some data from some remote source before the initialization of lock screen. So does auth0 provides any method like “onInitialize” or like “beforeSend” method of ajax?
By going through this link (https://auth0.com/docs/libraries/lock/v11) I found this:
document.getElementById(‘btn-login’).addEventListener(‘click’, function() {
lock.show();
});
I think this might also be used but is there any specific method provides by auth0 to do some work before the inilialzation of lock screen?
The events that Lock emits during its lifecycle are documented at (Lock API Reference), however, there does not seem to be one for your exact use case because the show
event would be triggered when Lock is already shown. It seems hash_parsed
is somehow connected to initialisation for certain Lock configurations:
hash_parsed
- every time a new Auth0Lock object is initialized in redirect mode (the default)…
However, it may indeed just be simpler for you to modify your own code to perform that request before creating any Lock object.
1 Like