skip to Main Content

Laravel Socialite Google OAuth with Sanctum: Session created but user_id is null after login

I'm building an API-only SPA with Laravel Sanctum and Nuxt3, using cookie-based session authentication. I’ve implemented Google OAuth using Laravel Socialite. Here’s my current setup for the Google OAuth flow: public function googleCallback() { $googleUser = Socialite::driver('google')->stateless()->user(); $user = $this->authRepository->show($googleUser->email);…

VIEW QUESTION

Laravel – Cannot authenticate using spa

I have my API that run on this url: https://example.com, and my vue.js app which runs on this: https://app.example.com. So I configured as the following the .env: SESSION_DOMAIN=.example.com SANCTUM_STATEFUL_DOMAINS=https://app.example.com the axios configuration contains the following: import axios from 'axios' const…

VIEW QUESTION
Back To Top
Search