Laravel Socialite

Install Socialite

composer require laravel/socialite

Create Application For Configuration

For Github: https://github.com/settings/applications/new

For Google: https://console.cloud.google.com/projectcreate

Setup Your Env

For your Google account add the credentials in .env file.

GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
GOOGLE_CALLBACK_URL=

For your Github account add the credentials in .env file.

GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
GITHUB_CALLBACK_URL=
Example:

If your callback url is http://localhost:8000/authorized/google/callback.

in Your .env

GITHUB_CALLBACK_URL=http://localhost:8000/authorized/google/callback

in Your routes file

Route::get('authorized/google/callback', [LoginWithGoogleController::class, 'handleGoogleCallback']);

For more information you can read here https://laravel.com/docs/10.x/socialite#configuration

Your callback url must be same as which you entered url when account is created.

© Judia.
Design & Develop by Themesbrand