laravel socialite code example

Example 1: socialite laravel 7

redirect();
    }

    /**
     * Obtain the user information from GitHub.
     *
     * @return \Illuminate\Http\Response
     */
    public function handleProviderCallback()
    {
        $user = Socialite::driver('github')->user();

        // $user->token;
    }
}

Example 2: socialite laravel 7

'github' => [
    'client_id' => env('GITHUB_CLIENT_ID'),
    'client_secret' => env('GITHUB_CLIENT_SECRET'),
    'redirect' => 'http://your-callback-url',
],

Example 3: socialite laravel 7

return Socialite::driver('github')
    ->setScopes(['read:user', 'public_repo'])
    ->redirect();

Example 4: socialite laravel 7

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

Example 5: laravel socialite

composer require laravel/socialite

Example 6: socialite laravel 7

return Socialite::driver('github')
    ->scopes(['read:user', 'public_repo'])
    ->redirect();

Tags:

Misc Example