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

**URL:** <https://community.auth0.com/t/how-to-make-a-web-request-before-auth-lock-screen-initialization/23588>\
**Category:** Get Help\
**Tags:** auth0-lock, lock-11\
**Created:** [April 5, 2019, 11:08am UTC](https://community.auth0.com/t/how-to-make-a-web-request-before-auth-lock-screen-initialization/23588 "2019-04-05T11:08:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jah](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jah/32/12805_2.png) [@jah](https://community.auth0.com/u/jah)\
**Post date:** [April 5, 2019, 11:08am UTC](https://community.auth0.com/t/how-to-make-a-web-request-before-auth-lock-screen-initialization/23588/1 "2019-04-05T11:08:26Z")

</div>

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 ([Lock for Web - Auth0 Docs](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?

---

<div class="post-metadata">

**Author:** ![jmangelo](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jmangelo/32/7923_2.png) [@jmangelo](https://community.auth0.com/u/jmangelo)\
**Post date:** [April 9, 2019, 10:31am UTC](https://community.auth0.com/t/how-to-make-a-web-request-before-auth-lock-screen-initialization/23588/3 "2019-04-09T10:31:22Z")

</div>

The events that Lock emits during its lifecycle are documented at ([Lock API Reference](https://auth0.com/docs/libraries/lock/v11/api#on-)), 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.

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [September 2, 2019, 8:55am UTC](https://community.auth0.com/t/how-to-make-a-web-request-before-auth-lock-screen-initialization/23588/4 "2019-09-02T08:55:16Z")

</div>


