I have a quick question that I've been battling for a little while.
I tried logging out by clearing the localStorage and cookie using the inbuilt nuxt-auth method but it doesn't seem to work. Below is what I tried separately but doesn't seem to work
handleLogout() {
this.$auth.$storage.removeUniversal("auth._token.local");
this.$auth.$storage.removeCookie("auth._token.local", isJson);
this.$auth.$storage.removeCookie("auth._token.local");
},
However, I tried clearing the storage using the window storage api, It clears it but immediately restores it.
Any help would be appreciated
Hi @joshtom! The built-in logout method do a lot of stuff in background, it doesn't simply clear the storage. So I would like to know what is the purpose of logging out by clearing the localStorage and cookies manually? This way I can help you better, because it really depends on what you want to achieve :)
Hi @JoaoPedroAS51! Thanks for the response.
There is no api endpoint for logout and I simply want to just clear the localStorage and Cookie so that the user gets redirected to the login.
Hope this explains it better. Thanks
Ok, got it. Then I recommend using the built-in logout method $auth.logout(), but in endpoints option set logout: false. This will disable the logout request, but still do the other stuff in background on logout :wink:
Thanks for this piece! It worked perfectly!
However, I have another question regarding Oauth, Should I open another issue or just go ahead with it?
I'm happy to know it's working now! And yes, let's open another issue