laravel 7 socialite tutorial code example

Example 1: socialite laravel 7

return Socialite::driver('google')->stateless()->user();

Example 2: socialite laravel 7

return Socialite::driver('google')
    ->with(['hd' => 'example.com'])
    ->redirect();

Example 3: socialite laravel 7

$user = Socialite::driver('twitter')->userFromTokenAndSecret($token, $secret);

Example 4: socialite laravel 7

$user = Socialite::driver('github')->user();

// OAuth Two Providers
$token = $user->token;
$refreshToken = $user->refreshToken; // not always provided
$expiresIn = $user->expiresIn;

// OAuth One Providers
$token = $user->token;
$tokenSecret = $user->tokenSecret;

// All Providers
$user->getId();
$user->getNickname();
$user->getName();
$user->getEmail();
$user->getAvatar();

Tags:

Php Example