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

andylarks's avatar

Your session has expired. -> trying to consume API - laravel5.6, spark6.0

Trying to follow tutorial here: https://laracasts.com/series/laravel-spark/episodes/5 Falling pretty quickly, because it's out of date :(...and I'm new to laravel & spark, so this is painful!

I worked out that:

1.) home.js should contain this (rather than what's in the video) import axios from 'axios'; Vue.component('home', { props: ['user'],

mounted() { axios.get('/api/test') .then(response => { console.log(response.data); }) } });

2.) In routes/api.php (not Http/routes/api.php), you don't need the 'prefix' => 'api' line! (that moves everything to api/api/thing)

However, when trying to visit the homepage, after login I get "Your session has expired."

Remove the axios.get from home.js and I can log in normally again.

A little help anyone?

Thanks

A.

0 likes
1 reply
duellsy's avatar

Had a similar issue recently, if this is related to upgrading to 5.6. try adding this

    protected static $serialize = true;

to your App\Http\Middleware\EncryptCookies middleware.

See here for more details: https://laravel.com/docs/5.6/upgrade

Please or to participate in this conversation.