So tools like CASL make it easy to manage different permissions for users in Vue.js. However, I am wondering what is the best and securest way to access user information in Vue.js when using Laravel? So far I only followed Jeffreys tutorials on laracasts and he simply put these information in the global head-tag via JS:
<script>
window.App = {!! json_encode([
'csrfToken' => csrf_token(),
'user' => Auth::user(),
'signedIn' => Auth::check(),
]) !!};
</script>
Is this really sufficient or is there a better solution? Feels a little dirty, especially considering that users could simply change their roles to admin/moderator to see their frontend.
Thank you!