Why does the vuejs tutorial initialise the auth0 instance inside the created lifecycle hook

I am trying to follow the guide for integrating auth0-spa-js in my VueJs app at https://auth0.com/docs/quickstart/spa/vuejs/01-login. The guide walks through creation of a plugin for Vue. What seems strange is that the auth0Client instance that gets attached to the Vue instance, via Vue.prototype is created inside the created lifecycle hook. This makes things difficult as creating the instance synchronously becomes way difficult as we cannot expect the lifecycle of the App itself to be after the lifecycle of the plugin. So, if we are checking for the auth0Client in our App.vue 's created hook, there is a chance that it might not be created.

Moreover, the closest architecture available in the official docs is the mixins way. But mixins are not suitable in this case. As such I am not able to find the justification of attaching a Vue instance instead of a normal javascript object. Am I missing something here?

I’m having an issue that is related to this. I’m attempting to build an application that is completely locked until the user is authenticated. By following the quickstart documentation and checking the loading status of the Auth0 object on the Vue instance it’s always true because the Auth0 hasn’t finished initializing.

Because it’s installed as a plugin, I’m having a really difficult time figuring out how to watch or wait for it to finish before I start loading my application.