Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

370
Visualizações
Error (@websanova/vue-auth): drivers/http/axios.js: http plugin has not been set

I'm trying to setup vue-auth into my laravel-vue application. But I'm getting console errors as

Error (@websanova/vue-auth): drivers/http/axios.js: http plugin has not been set.

Uncaught TypeError: this.plugins.http is undefined

and this is my app.js file content

import 'core-js/stable'

import Vue from 'vue'
import App from './App.vue'
import router from './router'
import VueAxios from 'vue-axios'
import CoreuiVue from '@coreui/vue'
import { iconsSet as icons } from './assets/icons/icons.js'
import store from './store'
import VueAuth from '@websanova/vue-auth/dist/v2/vue-auth.esm.js';
import auth from './auth';


Vue.prototype.$apiAdress = 'http://127.0.0.1:8000'
Vue.config.performance = true
Vue.use(CoreuiVue)
Vue.use(VueAuth,auth)

new Vue({
  el: '#app',
  router,
  store,  
  icons,
  template: '<App/>',
  components: {
    App
  },
})

and auth.js content

import Vue from 'vue'
import bearer from '@websanova/vue-auth/dist/drivers/auth/bearer.esm'
import axios from '@websanova/vue-auth/dist/drivers/http/axios.1.x.esm';
import router from '@websanova/vue-auth/dist/drivers/router/vue-router.2.x.esm';

// Auth base configuration some of this options
// can be override in method calls
const config = {
    plugins: {
        http: Vue.axios, // Axios
        router: Vue.router,
    },
    drivers: {
    auth: bearer,
    http: axios,
    router: router,
    tokenDefaultName: 'token',
    tokenStore: ['localStorage'],
    rolesVar: 'role',
   // registerData: {url: 'auth/register', method: 'POST', redirect: '/login'},
    loginData: {url: 'login', method: 'POST', redirect: '/dashboard', fetchUser: true},
    logoutData: {url: 'logout', method: 'POST', redirect: '/login', makeRequest: true},
    fetchData: {url: 'user', method: 'GET', enabled: true},
    refreshData: {url: 'refresh', method: 'GET', enabled: true, interval:30 },
    authRedirect: { path: '/' },
    parseUserData(response){
        let data = response.data;
        data.refresh = response.refresh_token;
        localStorage.setItem("user", JSON.stringify(data));
        return data;
    }
},
    options: {
        rolesKey: 'type',
        notFoundRedirect: {name: 'user-account'},
    }

}

export default config   

and I followed this tutorial https://websanova.com/docs/vue-auth/guides/startup to setup. please help me to find what i am doing wrong. Laravel Framework 8.6.0 and vue": "^2.5.17".

Thanks in advance.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I could find a solution.And this can be solved using https://websanova.com/docs/vue-auth/guides/startup tutorial guides.

After installing the websanova/vue-auth plugin, There are some dependencies that must be set before the plugin is installed

Router

The Vue.router must be set which then corresponds to the router driver installed with the plugin.

HTTP

An http plugin must be set which then corresponds to the http driver installed with the plugin.

as well as config.

Git: https://github.com/websanova/vue-auth/tree/master/demos/2.x/src

I setup the application as it setup in git main.js file.

And it worked.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda