A state of the art implementation for authentication using the composition API and vue router.
The goal of this exmaple is to provide a state of the art, clean implementation of authentication that follows the vue conventions and, in addition, satisfies the following statements:
- Uses
Composition APIandVue 3 - Uses
vue-routerto determine what pages are protected and what pages are not. - Does not use a global reactive variable that could theoretically be shared among apps and instead uses
provide/injectto provide authentication on the app level. - HoC component to do the job instead of a plugin because
provide/injectneeds to be inside asetup().