Nuxt Authentication with Laravel Sanctum
HTML-код
- Опубликовано: 19 окт 2024
- Want more? Explore the library at codecourse.com
A quickstart guide to authenticating in Nuxt with a Laravel API using Sanctum. We’ll use the latest version of nuxt/auth, which includes native support for Sanctum as a provider.
Official site
www.codecourse...
Twitter
/ teamcodecourse
Nicely explained Alex.
A video on Laravel Sanctum with GraphQL would be a great help as there are not many tutorials/guides, specifically with GraphQL.
best and easy tutorial for Laravel Sanctum with Nuxt Auth. Salute Sir. easiest explanation.
thank you very much Alex! i finally got the 'stateful' meaning and get it working properly!!!
Please make a video on nuxt auth configuration with Laravel passport, reading everywhere since yesterday but not in luck. Thank you 💕
Regarding what you said at 7:42 , you still need to add an index.js file inside the store folder, otherwise vuex will not work and you will need to refresh your page after logging in for example in order to see the changes.
Thank you missed this step. No wonder why login was not working.
THX BRO STILL WORKING
Thank you for this tutorial!
It would be great if you can continue with Two Factor Authentication 😁
had no choice but to subscribe...great video..short and useful
thank you for this video, was facing an issue with env var
i have this issue: '...CSRF token mismatch..." any idea? i pasted 1 day on this problem
You're a GEM
how can I do a mult-auth???
different authentication for /admin and another for /user???
2 separate dashboards, manipulating 2 separate user types (not role)
You did good tutorial on nuxt.js but registration and Login things makes us so difficult to understand can you add registration part on this
Awesome and helpfull
Thanks a lot !
can you make a tutorial how to deploy this?
Why didn't you get the CORS issue when you requested /login endpoint even if you did not exclude that endpoint in config/cors.php ?
great videos
Hi Alex hope you are doing great. I'm having an issue deploying the Nuxt js + Laravel application.
I have 2 index files ... of course I can't have them both ... The nuxtjs makes a index.html with all the app and the Laravel makes a index.php. So the issue is that if I left the nuxtjs one ... I can't access to Laravel Telescope/Horizon, and if I remove the index.html I can't access the Front-end I made with Nuxtjs.
Any ideas - videos - recommendations about it ?
Thanks in advance for your time !
Hey please on deployment, what would be the SESSION_DOMAIN
Nice! Any idea how I can add Google signin to work with this setup?
how to solve error with Session store not set on request. I using stateful sanctum
Is it possible? Laravel as backend and NuxtJs as a frontend to host into the same domain.
of course why not?
in which folder is the admin panel created? in client project or inside laravel project?
great !!!
But how to register via auth-next???
in LoginController Unhandled \Illuminate\Auth\AuthenticationException for throw new AuthorizationException
you did not provide middleware:['auth'] in nuxt.config , means your routes are not procteded on client side , you can acess any route without being logged in.If you add that , like docs says , than refreshing the page always redirects you to login even if you are already logged in.This is broken lib completely, just look at git issues
how to use SPA auth and TOKEN auth both together ?
is their a video about registering a new user?
I was wondering on that but registering a user does not use nuxt auth with sactum, you have to manually do that, send an API request to a register route in your laravel project but you will encounter CORS issues when doing that, to remove the CORS issues, first you have to make a request to Sanctum CORS then make your register request to the server.
@@ezekielwachira1691 oh yeah,, I actually figured it out, I create an API for my register function. Thanks :)
'/user' already return unauthentication
!!!!
i have a problem with CORS on localhost. What to do?
I had the same problem and changed the paths on the config file: cors.php :
'paths' => ['api/*', '/sanctum/*'],
then cleared cache with (important!):
php artisan config:gache
theme vscode?
This doesn't work with nuxt3
show to add register in this process?
I was wondering on that but registering a user does not use nuxt auth with sactum, you have to manually do that, send an API request to a register route in your laravel project but you will encounter CORS issues when doing that, to remove the CORS issues, first you have to make a request to Sanctum CORS then make your register request to the server.
CORS issues happening
github.com/nuxt-community/proxy-module
I had the same problem and changed the paths on the config file: cors.php :
'paths' => ['api/*', '/sanctum/*'],
then cleared cache with (important!):
php artisan config:cache
laravel doesn't load the cors.php config file edits until you clear the cache hence the cors error
@@douglasokonu2653 I solved it using proxy module 🤞
Hi bro first comment
thanks . can u help me out when i get this error No 'Access-Control-Allow-Origin'
I had the same problem and changed the paths on the config file: cors.php :
'paths' => ['api/*', '/sanctum/*'],
then cleared cache with (important!):
php artisan config:gache
then it worked
@@douglasokonu2653 this solution does not work
CORS errors everywhere. Tutorial is completely useless now, don't waste your time.
Same, doesn't work.
If you are having 401 unauthorized error after loggin, fix SANCTUM_STATEFUL_DOMAINS on .env file to " SANCTUM_STATEFUL_DOMAIN". It worked for me...