To add Login with Google to Laravel 13, install Laravel Socialite, create an OAuth client in the Google Cloud Console, put its client ID and secret in config/services.php and add two routes: one redirects the user to Google, the other receives the callback and logs the user in. This guide covers the full flow, including the settings that most often cause the "redirect_uri_mismatch" error.
Targets: Laravel 13 (PHP 8.3 to 8.5) and laravel/socialite , which includes a built-in google driver.
Step 1: Install Socialite
composer require laravel/socialite
Enter fullscreen mode
Exit fullscreen mode
Step 2: Create Google OAuth credentials
Open the Google Cloud Console and create a project (or pick an existing one).
Configure the OAuth consent screen: app name, support email and the contact email.
Create an OAuth client ID of type Web application .
Under Authorized redirect URIs , add your callback URL, for example http://localhost:8000/auth/google/callback .
Copy the client ID and client secret.
The…