diadal / vue-social-auth

Laravel Vue (SPA) Social Auth
75 stars 27 forks source link

Request handler instance not found #5

Closed rabichawila closed 4 years ago

rabichawila commented 5 years ago

Trying to implement this on nuxtjs, but i keep on getting this error:

Request handler instance not found

I am pretty sure that i have axios because it comes with nuxt js by default, and i'm using it in my app.

vue-social-auth.js

import Vue from 'vue'
import VueSocialauth from 'vue-social-auth'

Vue.use(VueSocialauth, {

  providers: {

    google: {
      clientId: 'xxxxxxxx-xxxxxxxxxxx.apps.googleusercontent.com',
      redirectUri: '/auth/google/callback' // Your client app URL
    }

  }
})

nuxt.config.js

plugins: [ 
    {src: '~/plugins/vue-social-auth', ssr:false},  
 ],

component.vue

AuthProvider(provider) {
        console.log(this.$auth);
}
diadal commented 5 years ago

Use the right google ‘clientId’ not app id

arhakim commented 5 years ago

Hi, I have the same issue.

I follow the auth config from Socialite

bootstrap.js

import Vue from 'vue'
import VueSocialauth from 'vue-social-auth'

Vue.use(VueSocialauth, {
  providers: {
    facebook: {
    client_id: 'XXX',
    client_secret: 'XXX',
        redirect: '/auth/facebook/callback'
    }
  }
});

login.blade.php

<button @click="authProvider('facebook')">Facebook</button>

. . . .
methods: {
    authProvider(provider){
    this.$auth.authenticate(provider)
    .then(response => {                 
        this.socialLogin(provider, response)
    }).catch(error => {
        console.log(error)
    })
    },
    socialLogin(provider, response){
    axios.post('/auth/'+provider, response)
    .then(response => {
        console.log(response)
        console.log(response.data)
    }).catch(error => {
        console.log(error)
    })
   },
. . . .

When the button clicked, I got error Request handler instance not found

soliduskodas commented 4 years ago

https://www.npmjs.com/package/vue-axios - this solved my issue.

import VueAxios from 'vue-axios' Vue.use(VueAxios)

AminBAROUDyassir commented 4 years ago

https://www.npmjs.com/package/vue-axios - this solved my issue.

import VueAxios from 'vue-axios' Vue.use(VueAxios)

Thank you very mutch , i want just to add another thing , it will work fine if you add this: import axios from 'axios' import VueAxios from 'vue-axios'

Vue.use(VueAxios, axios) you need to use axios and VueAxios in the some time.

Thanks