I'm new in VueJS and have a problem: I can authenticate a user with adldap2 in php. But how can I check in VueJS whether the user is authenticated? The login expires after 2 hours and the user should not be able to interact with the website when not longer logged in. By the way, I also need "Auth::user()" in backend.
So I try to find a way to get something like let user = Auth.user;
in VueJS and Auth::user();
in PHP.
I need it in VueJS for things like that:
<div class="row" v-if="Auth.checked">
<div class="col-md-12">
<!-- "navigation" is a custom component in VueJS -->
<navigation :items="menuItems" v-on:ask-upgrade="showUpgrade = true"></navigation>
</div>
</div>
I get a solution. Here is the tutorial what I used for my problem. My auth.js file is very larger now but I need a lot of auth stuff for routing.