I have the following setup:
- Quasar2 (Vue3)
- auth0-vue SDK
This setup is working, and I’m not improving the app. I have two questions:
- Am I using the right SDK? – Does it matter?
This topic mentions that auth0-vue is (mostly) a superset of auth0-spa-js: Which module to install for Vue3+Vite+VitePWA? (auth0-spa-js or auth0-vue?)
I am starting to wonder if it is not the other way around, or if they just serve different purposes; the spa-js library seems more complete (which is opposite of what the answer in that topic says).
This ties in to my next question:
- What would be the best-practice approach for running code (in the SPA) immediately after the client authenticates succesfully? For direct logins (using a button) this is pretty straight-forward. But I am not sure how to approach this when a returning user still has a valid authentication.
As far as I can tell, there are no callbacks for this. Searching the forums and the SDK-docs, I did find that the createAuth0()-function in auth0-spa-js is async, which you can await for a succesful (or not) authentication process. The auth0-vue SDK is not async. When in auth0-vue I check isAuthenticated immediately after createAuth(), it says false, even on a succesful auth (which probably happens very soon after the createAuth returns).
A watcher on isAuthenticated in the App.vue could maybe work, but it feels a bit “cluncky”, but hopefully there is a more “built-in” mechanism for this?
By the way, I selected “auth0-spa-js” as tag, “auth0-vue” seems to be missing.