I have a node.js (express, passport) application with rolling session authentication.
The application is simple enough, just login-password that returns the cookie for the session and a few API functions that are available only with authentication.
I want to use Vue.js as a front-end for that application but I'm unable to find any reliable documentation or a guide on how to implement such authentication in Vue. It seems like there is a heavy focus on JWT.
Is it even possible to do in Vue?
I've tried simply using Axios to call the authentication function
<script>
import router from ../router
import axios from axios
export default {
name: Login,
methods: {
login: (e) => {
e.preventDefault()
let email = [email protected]
let password = password
let login = () => {
let data = {
email: email,
password: password
}
axios.post(/srv/login, data)
.then((response) => {
router.push(/loginpage)
})
.catch((errors) => {
console.log(Failed to log in)
})
}
login()
}
}
}
</script>
This works in terms of log in but how do I store the session after I call this API? How do I handle the returned cookie and most importantly make the state of the app itself to the authenticated?