Auth0 Home Blog Docs

How to make a web request before auth lock screen initialization?

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 ( I found this:
document.getElementById(‘btn-login’).addEventListener(‘click’, function() {;
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 (, 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