Great question. I already answered this question to say the same thing.
Authentication is slightly different in SPA because you completely separate the Laravel and Angular applications. Laravel takes care of validation, logic, data, etc.
I highly recommend you read the article below.
You can use Laravel's route filters to protect your routes from unauthorized users. However, since your Laravel application is now only the endpoint, the frontend infrastructure will do the heavy work of authentication and authorization.
Once you have installed route filters, this does not prevent authorized users from trying to perform actions that they are not allowed to do.
What I mean above is for example:
You have an API endpoint: / api / v1 / users / 159 / edit
The endpoint is one of RESTful 7 and can be used to edit the user. Any software engineer or developer knows that this is a RESTful endpoint and, if permitted by your application, can send a request with data to this endpoint.
You only want user 159 to be able to perform this action or by administrators.
The solution to this is the roles / groups / permissions that you want to name. Set the user permissions for your application in the Angular application, and possibly save this data in the token release.
Read this great article (in AngularJS) on how to properly authenticate / allow the use of JavaScript frameworks.
Article: https://medium.com/opinionated-angularjs/techniques-for-authentication-in-angularjs-applications-7bbf0346acec
user4097807
source share