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

cakadi190's avatar

How I Can Turn On Session On API Laravel?

I got error when /api/ url are not save my auth session, but meanwhile on regular url working, how i can solve it?

0 likes
6 replies
martinbean's avatar
Level 80

@cakadi190 You don’t “solve” it. APIs are typically stateless. You should be using a token-based authentication mechanism for your API such as Passport or Sanctum. Not sessions.

2 likes
cakadi190's avatar

In this case i use Vue.js with Laravel, that's pure vue.js like this site. So i can't load api login into regular api. And am i can solve that?

Remembering the vue.js are SPA typically with # (hash) url or not...

cakadi190's avatar

Okay lemme check it, thanks for suggesting me 😁

jlrdw's avatar

@cakadi190 which are you going to use, token based or cookie based session authentication services.

Please or to participate in this conversation.