p0t4t0
135
0
Vue

need advice with my vue + passport login system

Posted 1 year ago by p0t4t0

so I tried creating a login system with Vue + Laravel Passport without making use of the /oauth/token route and having to send the client_id and client_secret along with my ajax request, although it works I kind of have the feeling that I am overdoing it, here is my flow

  1. User hits submit on login form, form sends an ajax post request to a LoginController
  2. LoginController validates data, creates a token if data is valid, sends token back to Vue
  3. Vue stores token in localStorage, sets window.axios.defaults.headers.common.Authorization to 'Bearer ' + the token that was sent from the LoginController
  4. Send a post request to '/api/user' to get user details

so any thoughts on how I can improve it? P.S. this is a first party login and I am just trying to make my api endpoints inaccessible to anyone outside of my user base

Please sign in or create an account to participate in this conversation.