-
-
Notifications
You must be signed in to change notification settings - Fork 382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auth.register storing in sessionStoage instead of localStorage despite staySignedIn: true #610
Comments
Hmm, strange, should be working. https://vue-auth.websanova.com/ That is exactly from the demo code working there, seems ok. How are you making your register call, are you sure it's not being overridden? |
100% sure nothing is overriding, to actually see that was the problem, I had to do a "blank" project. Here's a video. |
show your register code.... |
It was in the initial message with one additionnal line, I use it in a Vuex action: register({ commit }, data) {
return Vue.auth.register({ data })
.then((res) => {
// Vue.auth.token(null, Vue.auth.token(), false);
commit('update', res.data.data);
router.push({ name: 'home' });
});
}, PS: I use axios that's why it's |
Right, but what's in your Also did you try a call directly with to Some basic debugging would help ;-) |
Well as the previous code shows, it passes an object with a data key holding the payload passed to axios (so basically only the register payload: firstname, lastname, email, password). Despite that, I went along even if, I don't see how relevant this.$auth.register({ data: this.user })
.then((res) => this.$store.commit('auth/update', res.data.data)) Event tried without any update to the store and same thing goes on, stores in sessionStorage instead of localStorage but only on the register method.
I don't see what you mean by that here. What would you like? |
Well, came to the bottom of it: Line 192 in 8be7a27
.register you actually never set this value.
While in Line 574 in 8be7a27
So basically, in the interceptor you always set token expires to "true" because in the |
Wait, just realized you have |
Ok, just did a small update in And if you haven't updated to 4.x yet check the upgrade guide. https://websanova.com/docs/vue-auth/upgrades/3x-4x Just a couple minor tweaks necessary to plugin setup/install. |
Yes, as shown in my code autoLogin is at false, and as said below
My API sends the auth token on register with the user data as response, indeed. |
Closing due to inactivity |
I have a weird issue, it really took me sometime to figure this behaviour.
On registration me users would be logged in but logout after leaving the tab, while on "login" they would stay signed in as usual.
It seem's when using "storage" value on
store
option, which is the default value, on.login()
thestaySignedIn: true
works and saves in thelocalStorage
, but on.register()
it doesn't work, and stores in the "sessionStorage' instead.I have to manuelly set expiry to false, which isn't the expected behaviour:
Why is the behaviour like that?
knowing my config is:
There isn't any
staySignedIn: true
on register in the docs but that's how I set the thing hoping it would workThe text was updated successfully, but these errors were encountered: