[Vuejs]-How to properly check authentication with Vue.js (Vue router) and Django

0👍

Please consider adding routing guard on protected routes.

Vue Router permits you to do stuff before entering any route.

The following docs get you covered. Do remember that your API response is what rules you front end. So for checking if a sessionid is still valid, you can create an endpoint to do that and when it respond with an expired state, your frontend should unset everything related to the session in your vuex store and from the local storage, then redirect the user to the connexion page!

Leave a comment