DEV Community

KP
KP

Posted on • Updated on

How to implement Auth using Laravel & Nuxt.js (framework for Vue.js)

I am trying to implement Authentication for a Nuxtjs + Laravel app.
I would like my app to allow register + login with email and social (google, facebook, linkedin and twitter).

What is the best way to approach this? Should the auth happen in the back-end (Laravel) via Nuxt making API calls to the back-end? Are there other approaches? Pros and cons? Pointers to github repos are appreciated! I love to copy-and-paste :D

PS. Also I've heard about JWT but don't understand how it's any better than regular auth.

Discussion (7)

Collapse
lilianaziolek profile image
Lili Z

Hi KP, as I see you don't have any responses still, the only help I have as of now is here: github.com/lilianaziolek/vue-full-...
The rest of this app is either not applicable to you (Java) or not how I'd do it now (knowing Nuxt better now - this was written over a year ago, when I was still very much a Vue/Nuxt newbie) - but perhaps it will give you something to start with.

Collapse
kp profile image
KP Author

Thanks @lilianaziolek I appreciate it! Very kind of you.
Btw I just discovered Inertia.js (which integrates Laravel and Vue into one repo, and it has the benefits of client-side rendering
reinink.ca/articles/introducing-in...
github.com/inertiajs/inertia-laravel
So I am toying with this for now. If I can simplify my stack by getting rid of Nuxt, while still having the benefits of client-side rendering, that might be a win. We'll see how it goes though, for all I know I may end up coming back to Nuxt :)

Collapse
dialaeke profile image
Eke Enyinnaya Diala

Congrats! Inertia is now stable for use in production.

twitter.com/reinink/status/1161356...

The docs are still been worked on but if you subscribed to the mailing list you can see the new docs. If you didn't here it is: inertiajs-new.netlify.com

PS: The website is not to be shared publicly yet. It is still in development.

Thread Thread
kp profile image
KP Author

Thanks, Inertia doesnt do SSR so I've settled on Nuxt and Laravel.

Collapse
lilianaziolek profile image
Lili Z

hmmm, never heard of Inertia.
Good luck and my gut feeling is you will come back to Nuxt indeed - but only time will show :)

Thread Thread
kp profile image
KP Author

Thanks :) I guess time will tell! :)

Collapse
dialaeke profile image
Eke Enyinnaya Diala • Edited on

If you haven't already found a solution to this Nuxt has an auth module that provides a solution to this.