How to get details for laravel sanctum - laravel

I know that with JWT, you can decode the token and get the details from it. In doing so you can validate in your standalone frontend app.(eg Vue js)
Is there a way to do the same thing with laravel sanctum with an SPA not on the same domain? If yes please how?

Related

Secure web routes with laravel passport token

I am newbie with laravel.
I understand that in order to protect routes, you have to first check if a user is authenticated and a session is made. thus, we apply auth middleware in the web routes.
However, I am trying to implement laravel passport and now I am not able to proceed to my routes anymore since I have been authenticated using the passport.
My question is that is it possible to secure the web routes with passport token instead of laravel session? and if so, how one should do it?
Thanks, sorry for english, not native speaker.
Laravel passport is for API routes not for web routes you can use laravel session for web
for more details read it's documentation
https://laravel.com/docs/8.x/passport

Laravel - Vue.JS - Auth JWT vs Laravel Auth with Axios

I want to understand difference JWT Auth vs Laravel Auth with Axios.
In Laravel Auth with Axios, we can use standard middleware and things from Laravel Auth. Can someone explain me why People always choose JWT? It's got something than Laravel Auth with Axios don't have? We can always set a variable in JS with auth true/false when user it's logged in by Laravel (it checks session/cookies for that) and check that variable before route change?

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 :)

Should i use Laravel Passport or JWT resource?

I know passport uses oAuth, but my question is.. is it better to use Passport for Auth (Login and Register) or should i use jwt for login and register and Passport for external API requests... or use passport for both (User API and Login/AUTH)
Now i'm programming a SPA website with laravel and VueJs 2, i'm stuck in this.
Laravel Passport does, in fact, use JWT so comparing "JWT vs Passport" is kind of wrong.
You can use Laravel Passport for everything you mentioned - logging in, registering (not built-in in Passport but easy to add) and protecting external API requests.

Laravel 5.2 passport authentication with angular 2

I'm just new to laravel passport so it is kind of confusing to me. I have watched Taylor otwell tut on passport but still I am not able to figure out that Is it possible to authenticate an angular app with laravel passport?
What I want to do is build a Full SPA application with angular 2 as frontend and laravel 5.3 as back-end. I've used JWT for authentication with laravel on version 4.2 but just want to know if it is do able through laravel passport.
Your comments and answers will be appreciated.
Thanks
Yes it is possible but it's also more complicated then it was in Angular 1.
This entry could be helpful:
Angular2 - set headers for every request
because you need to pass CSRF token to the app to consume your application as it's written here:
https://laravel.com/docs/5.3/passport#consuming-your-api-with-javascript

Resources