0

I am creating small project in Laravel. I made a small CMS based on vue.js (it is component based SPA application) and now I (as Admin) want to insert manually users to database (username, email, password, and boolean isAdmin) from vue's component.

And questions is how can I do that in secure way?

Grzegorz G.
  • 1,285
  • 2
  • 14
  • 27

1 Answers1

1

I've been using vue-auth to handle this in my projects. It injects itself into requests and responses through vue-resource or axios HTTP client and allows for various authentication schemes. JWT is one popular option, I use bearer authentication.

I use Rails for my APIs so I can't give advice on the Laravel end of things, but the basic flow is -

  1. Vue client POSTS login request
  2. Server responds OK and sends back JWT, bearer token, or some other payload for the client
  3. Vue-auth processes this response and then injects it into future requests to the server, authorizing the request
Justin
  • 2,883
  • 1
  • 17
  • 25