jeudi 29 juin 2017

Laravel Spark API endpoint for guests but also with the web middleware

A requirement of a project means I need to create a customer registration that has its own API endpoint.

In the API controller I am using:

Auth::login($user, true);

To login the user after creating it. The issue is that I can go back to the login page etc so the user is not getting logged in.

My initial thoughts are that this middleware:

'guest:api'

Doesn't have access to sessions, is there anyway I can make this API call work for non logged in users but also use sessions?

If I use the web middleware I get CSRF errors which I don't really need to mess with due to Spark doing it all for me normally.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire