Home > Article > Backend Development > Laravel 第三方登录,支持微信、QQ
Laravel 第三方登录,支持微信、QQ。
使用 composer 命令
composer require weann/socialite
注册服务提供者
Weann\Socialite\SocialiteServiceProvider::class,
注册Facade
'Socialite' => Weann\Socialite\Facades\Socialite::class,
配置文件config/services.php
'wechat' => [ 'client_id' => 'APP_ID', 'client_secret' => 'APP_SECRET', 'redirect' => 'CALLBACK_URL'],
Route::get('/', function () { return Socialite::driver('wechat')->redirect();});
授权后的回调。
Route::get('callback', function () { $user = Socialite::driver('wechat')->user() dd($user);});
项目主页:http://www.open-open.com/lib/view/home/1438146894410