Tutorial by Examples

composer require laravel/socialite This installation assumes you're using Composer for managing your dependencies with Laravel, which is a great way to deal with it.
In your config\services.php you can add the following code 'facebook' => [ 'client_id' => 'your-facebook-app-id', 'client_secret' => 'your-facebook-app-secret', 'redirect' => 'http://your-callback-url', ], You'll also need to add the Provider to your config\app.php L...
return Socialite::driver('facebook')->redirect(); This will redirect an incoming request to the appropriate URL to be authenticated. A basic example would be in a controller <?php namespace App\Http\Controllers\Auth; use Socialite; class AuthenticationController extends Controller...
/** * LoginController constructor. * @param Socialite $socialite */ public function __construct(Socialite $socialite) { $this->socialite = $socialite; } Within the constructor of your Controller, you're now able to inject the Socialite class that will help you handle login with so...
public function facebook() { return $this->socialite->driver('facebook')->stateless()->redirect()->getTargetUrl(); } This will return the URL that the consumer of the API must provide to the end user to get authorization from Facebook.

Page 1 of 1