PHP code example of xuejd3 / socialiteproviders-v2ui_bbs

1. Go to this page and download the library: Download xuejd3/socialiteproviders-v2ui_bbs 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/ */

    

xuejd3 / socialiteproviders-v2ui_bbs example snippets


return [
    // a whole bunch of providers
    // remove 'Laravel\Socialite\SocialiteServiceProvider',
    \SocialiteProviders\Manager\ServiceProvider::class, // add
];

namespace App\Providers;

use Illuminate\Support\Facades\Event;
use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     */
    public function register(): void
    {
        //
    }

    /**
     * Bootstrap any application services.
     */
    public function boot(): void
    {
        Event::listen(function (\SocialiteProviders\Manager\SocialiteWasCalled $event) {
            $event->extendSocialite('v2ui_bbs', \SocialiteProviders\V2uiBbs\Provider::class);
        });
    }
}

'v2ui_bbs' => [
    'client_id'     => env('V2UI_BBS_KEY'),
    'client_secret' => env('V2UI_BBS_SECRET'),
    'redirect'      => env('V2UI_BBS_REDIRECT_URI'),
    'guzzle'        => [
        'headers' => ['User-Agent' => 'xuejd3/socialiteproviders-v2ui_bbs'],
    ]
]

return Socialite::driver('v2ui_bbs')->redirect();

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

$user->getId();
$user->getName();
$user->getEmail();
$user->getAvatar();
.bootstrap/providers.php