dgrubelic / vue-authenticate

Simple Vue.js authentication library
1.43k stars 251 forks source link

Can this be used without vue-axios - just axios? #130

Open menasheh opened 6 years ago

menasheh commented 6 years ago

I just want to use axios and don't feel the need to add bloat with wrapper classes like vue-axios. I already use axios in my vue app and don't need vue-axios. Is there a way to get vue-authenticate to use it without the wrapper class?

Kuzzy commented 6 years ago

Up!

dgrubelic commented 6 years ago

Sorry, i was a bit off from this project. Starting to resolve these issues now...

You can use only axios, but you'll have to use vue-authenticate as a service, instead as a Vue plugin. Just like here (https://github.com/dgrubelic/vue-authenticate#vuex-authentication), instead of passing Vue.prototype.$http, you should be able to pass axios object and the rest should work. Give it a try and let me know.

pnowy commented 6 years ago

@menasheh example:

const http = axios.create({})

const vueAuth = new VueAuthenticate(http, {
  baseUrl: 'SERVER API URL'
  providers: {
    google: {
      clientId: 'some-random-id',
      redirectUri: 'http://localhost:3000/auth'
    }
  }
})