I don't know if this is possible, but I would like to refresh tokens when they expire. In my application, when a user logs in, he gets an access_token and a refresh_token, but using the current module I think it's not possible to store the refresh_token.
Is there any event that gets fired when the user logs in? Is there any plan to also set a property to store the refresh token? Is there any way of doing it with the current version?
@Guito
We will add the posibility to refresh the token with #61 (multi-strategy), login is a promise also, so you could set the refresh_token to Vuex manually :)
@breakingrobot @pi0
Currently this.$auth.login does not provide a valid response on then block. So we cant get any data, as refresh_token or any custom data, to set it manually on vuex store.
this.$auth.login({
data: { credentials in here }
}).then(res => {
console.log(res) // undefined
})
Please, see #105
@breakingrobot Is there any ETA on this? As @robsontenorio said the promise response is not returning anything:
return this.$auth.loginWith('local', {
data: {
username: this.username,
password: this.password
}
}).then(response => {
console.log(response);
})
In the console 'undefined' is displayed.
Also, if the token expires, is there any way of retuning the user to the login page using the plugin? What would you suggest otherwise?
@Guito Should have been fixed in 4.1, if not open a related issue.
@Guito i have proposed a PR , but it was refused because 4.0 was launched
@breakingrobot Still not working. I'm creating a new issue: https://nuxtjs.cmty.io/nuxt/consola/issues/c6 (I created it for consola instead of auth, is it possible to move it?)
@robsontenorio I tried doing a branch using your code about the refresh token but it's not working for me. Do you have any working example?
@Guito after 4.0 release the code became incompatible. I should rework it. But, the merge depends on core team.
@robsontenorio Would be happy to merge it 馃憤
Most helpful comment
@Guito after 4.0 release the code became incompatible. I should rework it. But, the merge depends on core team.