PHP code example of tollbridge / laravel-socialite

1. Go to this page and download the library: Download tollbridge/laravel-socialite library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

tollbridge / laravel-socialite example snippets




return [
    'app_id' => env('TOLLBRIDGE_APP_ID'),
    'client_id' => env('TOLLBRIDGE_CLIENT_ID'),
    'client_secret' => env('TOLLBRIDGE_CLIENT_SECRET'),
    'routing' => [
        'login' => '/tollbridge/login',
        'logout' => '/tollbridge/logout',
        'callback' => '/tollbridge/callback',
    ],
];

Route::get(config('tollbridge.routing.login'), function () {
    //session()->set('url.intended', request()->input('url'));
    //..
    return Socialite::driver('tollbridge')->redirect();
});

Route::get(config('tollbridge.routing.logout'), function () {
    //session()->flush();
    //..
    return redirect()->intended();
});

Route::get(config('tollbridge.routing.callback'), function () {
    $user = Socialite::driver('tollbridge')->user();
    //session()->put('user', $user);
    //$user = Socialite::driver('tollbridge')->userFromToken($user->token);
    //$user->getName();
    //$user->getEmail();
    //$user->getPlan();
    //..
    return redirect()->intended();
});
text
TOLLBRIDGE_APP_ID=
TOLLBRIDGE_CLIENT_ID=
TOLLBRIDGE_CLIENT_SECRET=
text
php artisan vendor:publish --tag=tollbridge-config