Vue Auth / Upgrades / 3.x to 4.x

There are only 2 changes to be aware of that will affect any 3.x version app.

Upgrade time: less than 5 minutes.

New options format.

The options format has three outer objects now where all dependencies must be defined.

This change should help with many issues arising about missing dependencies for router and http plugins and also works better in support for Vue 3.

NOTE: Below shows setup for Vue 2.

import Vue from 'vue';

import auth                  from '@websanova/vue-auth/dist/v2/vue-auth.common.js';
import driverAuthBearer      from '@websanova/vue-auth/dist/drivers/auth/bearer.js';
import driverHttpAxios       from '@websanova/vue-auth/dist/drivers/http/axios.1.x.js';
// import driverHttpVueResource from '@websanova/vue-auth/dist/drivers/http/vue-resource.1.x.js';
import driverRouterVueRouter from '@websanova/vue-auth/dist/drivers/router/vue-router.2.x.js';
import driverOAuth2Google    from '@websanova/vue-auth/dist/drivers/oauth2/google.js';
import driverOAuth2Facebook  from '@websanova/vue-auth/dist/drivers/oauth2/facebook.js';

driverOAuth2Google.params.client_id = '547886745924-4vrbhl09fr3t771drtupacct6f788566.apps.googleusercontent.com';
driverOAuth2Facebook.params.client_id = '196729390739201';

Vue.use(auth, {
    plugins: {
        http: Vue.axios, // Axios
        // http: Vue.http, // Vue Resource
        router: Vue.router,
    },
    drivers: {
        auth: driverAuthBearer,
        http: driverHttpAxios, // Axios
        // http: driverHttpVueResource, // Vue Resource
        router: driverRouterVueRouter,
        oauth2: {
            google: driverOAuth2Google,
            facebook: driverOAuth2Facebook,
        }
    },
    options: {
        rolesKey: 'type',
        notFoundRedirect: {name: 'user-account'},
        ...
    }
});

Default is for Vue 3 version.

The auth plugin now defaults to the install file for Vue 3.

To use the Vue 2 version it must be explicitly set (full example above).

import Vue from 'vue'

import auth from '@websanova/vue-auth/dist/v2/vue-auth.common.js';

...

Vue 3 setup

For the Vue 3 setup please refer to the Startup Guide.