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

douglas_quaid's avatar

Access to API via a guest account with abilities

Hi,

So, Spark comes shipped with the following middleware on all API routes

Route::group([
    'middleware' => 'auth:api'
], function () {
...
});

This means that you cannot access data and hit routes from the API as a guest. However, I'd like for a guest to be able to READ ONLY a few routes, so that I can render all of my content via Vue.Js templates onto the page.

I do not want to remove the above middleware or make a separate route group without the middleware as I don't want anyone to be able to hit these routes in the browser.

How would I go about auto-signing in all guests that visit my spark app as a guest account with specific abilities to READ ONLY specific routes? What files would I need to edit? Any suggestions?

Hope the above makes sense. Thanks :)

0 likes
2 replies

Please or to participate in this conversation.