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 istoken
and the value is something likeBearer ${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();
Source:stackexchange.com