authenticationvuejs2laravel-5.4adldap

Laravel 5.4 VueJS 2 adldap2 authentication


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>


Solution

  • 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.