Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

bashovski's avatar

Authentication via JWT or session with Vue.js

I was wondering what is the best way to authenticate user actions on the backend by sending HTTP requests via Axios. At the moment, I want to implement private messages in my little project and I am trying to find the best way to authenticate the user who is sending the message.

Thanks in advance.

0 likes
1 reply
tykus's avatar

That depends on how you are using Vue in you Laravel app. A pure SPA will need a token (e.g. JWT) to authenticate the user. For an application that uses a sprinkling of Vue in Blade templates, you can use the session and cookies.

Please or to participate in this conversation.