Sending api requests with login info from my app
Hello everyone. I am a long time lurker, this is my first post in this great community.
I'm building an app in Laravel and I'm still thinking about api auth strategy.
In the application, there will be many dynamic parts (e.g. infinite scroll - loading new friends posts when the user is signed in) and, of course, I'm using Vue and Axios for this. As I will make mobile version of the app in the future (and my plan is to use some of the api routes for this), sending csrf token with each request is not a good option. So, I will use JWT or Passport.
I am not sure how to do this. Here is my idea - I can make api route for logging in and when an user logs in via web route, Vue component should send login request to the api route. When the token is received, it should be stored in Local Storage and send again and again / vue-auth can be used for this.
Does this seem right to you? Is there any better solution when we talk about sending requests with credentials/token from vue component in the app? Thanks in advance!
Please or to participate in this conversation.