Comments (9)
Is this enhancement going to completely drop support for vue-resource? im all in favour of that, but I am testing the latest release doing this
import Vue from 'vue'
import axios from 'axios'
import VueAxios from 'vue-axios'
Vue.use(VueAxios, axios)
const vueAuth = new VueAuthenticate(Vue.axios, {
baseUrl: 'http://localhost:4000'
})
And get thrown an error
cannot read property 'interceptors' of undefined
from vue-authenticate.
It is because you need to setup request/response interceptors (this enhancement is not implemented yet) through interceptor binding methods. This is just a task/info that i plan to do it. Currently, default interceptors bindings are for vue-resource
. Once i implement this task, default interceptors will be for axios
.
And no, this will not drop support for vue-resource
, since this library allows you to have any request handling library you want (using these interceptor bindings - if library supports it).
from vue-authenticate.
@dgrubelic when we can expect this update for axios?
from vue-authenticate.
It shouldn't be too much work, but i'm a bit booked these days su i probably won't be able to do it this week, so Maybe next week...
from vue-authenticate.
@dgrubelic, I'm waiting for this improvement too.
I've tried serval configurations but without success..
Do you think it will be possible to work on that ?
Thanks !
from vue-authenticate.
@dimalusa what problem are you having? I managed to implement this with axios. Make sure you define your interceptors (as explained in the README) and you have the correct requestDataKey configured #31
You might find some inspiration in #28 as well.
from vue-authenticate.
Looking forward to the default axios functionality. Any progress on it?
from vue-authenticate.
This works for me:
Vue.use(VueAxios, axios)
Vue.use(VueAuthenticate, {
baseUrl: 'http://localhost:3000', // Your API domain
providers: {
// ...
},
bindRequestInterceptor () {
this.$http.interceptors.request.use((config) => {
if (this.isAuthenticated()) {
config.headers['Authorization'] = [
this.options.tokenType, this.getToken()
].join(' ')
} else {
delete config.headers['Authorization']
}
return config
})
},
bindResponseInterceptor () {
this.$http.interceptors.response.use((response) => {
this.setToken(response)
return response
})
}
})
from vue-authenticate.
As you may already know, axios
is now default request library from version 1.3.1. Closing issue...
from vue-authenticate.
Related Issues (20)
- ajv vulnerabilities
- Vue 3 Support HOT 8
- Facebook Login Issue HOT 1
- There is 1 vulnerability that requires manual review in current version HOT 2
- Can I use OAuth2 Class directly? or Could you please consider exporting it? HOT 5
- Better doc HOT 1
- Git hub login not working for the first time HOT 1
- Can this be used for an enterprise identity provider (non-Social provider)? HOT 8
- Why am I able to consume sensitive API data despite not having token?
- Externalise promise polyfill?
- Provide typescript definitions HOT 1
- Allow for non-pop login screen HOT 6
- Document all providers options
- Allow over-riding redirectURL in authenticate() arguments
- LinkedIn provider Authentication failed HOT 1
- Project Status? HOT 5
- Switch to async/await
- access token doesn't set with enabled adblock (uBlock) - v1.5.0 HOT 1
- Github login redirection issue HOT 1
- v1.5.0 Not perfectly compatible with older versions
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vue-authenticate.