Vue application. How to skip authentication to show some component? - laravel

I am working with vue and laravel application. I need to show component without user having to login. At the moment, to view the component(that has safety instructions), user have to login. But Now The component is needed outside meaning no login required to view that specific page. How can I achieve this in vue laravel application?

If your Vue app is under protection of 'auth' middleware, you won't be able to reach it before login. Where you need Vue component use web middleware. But to be able to fetch data by Vue component, you will still need a token protection like Sanctum.

Related

how to call login function in fortify laravel

I'm using api in a laravel project
and this project contains multiple laravel apps
one of these apps called auth which is responsible of authentication in other apps
me want to request form another apps to this app for login and authorize users
and i'm using livewire and jetstream in auth app and guzzle php package in another apps for api requests
however i need to use fortify function for login when request receive from another apps
but i dont know this function is exist or i have to create this function and what the way for this work?
if you know a better way, let me know , thank you

how to use cartalyst sentinel permission check in laravel vue spa?

I am building a SPA with laravel and Vue js. For authentication, I have used cartalyst/sentinel package. I am facing a problem to implement permission check in frontend. In the backend I have checked for the permission with Sentinel::hasAccess() function. But in the frontend, I don't have any idea how can I check for permission. As I am using Vue SPA but they don't provide any helper function for SPA frontend.
You could return an array with all the permissions and save it in your vue state and then to verify a permission you could do the following:
<button v-if="permisions['user.delete']" >delete user</button>

How can I give api authentication from existing web middleware login in laravel

I have a existing admin panel in a laravel based web application. I made few part of this admin panel in vue.js single page application. I don't wanted to use token based authentication for this spa part of this application. How can I give api authentication from my existing session login system.
Change the auth:api middleware to just auth in ./routes/api.php
And in ./app/Http/Kernel.php \Illuminate\Session\Middleware\StartSession::class, to the middlewareGroups array under api

How to check if user authentication or not in VueJs while using traditional laravel authentication

I am building an application using Vue, Vuex and Laravel.
The data for the JS is consumed using the steps in below link and it works fine. I use normal Auth::routes() for authentication.
https://laravel.com/docs/5.6/passport#consuming-your-api-with-javascript
But the tricky part for me is to update the Vuex state if the user is authenticated or not, as this is not a ajax request.
I need above especially for the case lie...Suppose in Vue component i have a which should be visible only for authenticated user, I need a state which holds this information.
I can find lot of tutorials using JWT, where a action authenticates a user and updates the state, but not the traditional authentication method nad vue.
Could someone please help on this?

How should I authenticate in SPA using VueJS and Vue Router?

I am building a SPA website with Laravel for back-end and VueJS for front-end. And now I want to authenticate users in my website. So I used Laravel Passport for that. My question is that how should I keep user access token and refresh token in vue to make another requests for authentication required routes? Thanks in advance :)

Resources