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

haydenp's avatar

Spark "Session Expired" when $usesApi = false

The Spark documentation says ...

To enable API support, make sure that the $usesApi property of your SparkServiceProvider is set to true.

I do not wish to show the 'API' tab under the settings section. If I set $usesApi = false; in the SparkServiceProvider, the 'API' tab is removed as expected but my session is no longer valid. If I try log in, it simply states 'Your session has expired. Please login again to continue.' and I'm no longer able to login.

Is that the correct behaviour? I was not expecting the 'API' tab functionality to be tightly coupled with the token authorisation?

Other than commenting out the 'API' related markup in the blade, is there another way of not showing the 'API' tab under the settings section?

Thanks.

0 likes
6 replies
manshu's avatar

I had the same issue, clear cache and views and try again. It will work fine.

haydenp's avatar

Thanks for your reply manshu

I tried:

php artisan cache:clear

php artisan view:clear

... and even threw in composer dumpautoload

but still no luck !?!

:-(

ejdelmonico's avatar

Try php artisan config:clear Laravel caches all config values so its worth a shot. Also, if you issue is that you are trying to login via token, I don't think it will work if you disable api. Use Passport

andyscraven's avatar

Boy oh Boy am I glad I found his post. I would never have thought that was the reason. Thanks @manshu

Please or to participate in this conversation.