I am trying to follow the guide for integrating auth0-spa-js
in my VueJs app at Auth0 Vue SDK Quickstarts: 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?