SocialiteController
class.
Redirecting to the OAuth Provider
Theredirect
method in the SocialiteController
class is used to redirect the user to the OAuth provider. The method accepts a driver
parameter which specifies the OAuth provider to use.
Handling Provider Callbacks
Thecallback
method in the SocialiteController
class is used to handle the callback from the OAuth provider. It retrieves the user details from the provider and creates or retrieves the corresponding user record in the application’s database.
Routes
The routes for social authentication are defined in theroutes/auth.php
file. The routes use the SocialiteController
class, and the redirect
and callback
methods respectively. These routes are grouped under a middleware that ensures only guest users can access them.
To learn more on how to create Google, Twitter or Github OAuth applications, refer to the main doc Social Auth