Next.js Discord

Discord Forum

Next Auth integration with Laravel Sanctum Session

Unanswered
Capelin posted this in #help-forum
Open in Discord
Avatar
CapelinOP
Hello, i wanna know if there's a video tutorial or blog of integrating next auth with laravel sanctum session. I have been searching for it and all of them are JWT based authentication.

I know this is not a "help" but i cant post a message in discussion channel

Thank you.

6 Replies

Avatar
Alfonsus Ardani
This is considered a help, and you can also still discuss it in #NextAuth.js but you've created a post now
If laravel is already managing the session + authentication, i dont think theres a need to use NextAuth anymore
Avatar
CapelinOP
But how can i manage the session on the frontend side?

Like, if i want to retrieve authenticated data in server components, and expire the authentication.
Avatar
Alfonsus Ardani
If your laravel store cookie in the client, you can get the users cookis using cookies() in nextjs
Then you can use that token from cookie, be checked against the laravel server
Expiring the session can simply be done by directly calling the laravel server and removing the cookies. Then you can just refresh the site and you wont be authenticated