[Vuejs]-Keeping a user logged in from a Vue.js SPA outside the SPA (websanova)

0👍

I don’t know laravel at all, but here is the general idea of what I would do, from your single page:

  • on a first request, query a route on laravel to get the jwt (sometime this route is /me).
  • on the next requests, inject the jwt in the page headers. The token name is token and the value is something like Bearer ${token}.

On the server side, check if the token is valid before to proceed the request.

Hope this helps.

0👍

you can use this method, I used in my project it work cool.

auth('api')->user();

Leave a comment