weann / socialite
Laravel wrapper around OAuth 1 & OAuth 2 libraries.
Installs: 1 371
Dependents: 0
Suggesters: 0
Security: 0
Stars: 30
Watchers: 7
Forks: 8
Open Issues: 1
Requires
- guzzlehttp/guzzle: ~6.0
This package is not auto-updated.
Last update: 2024-11-13 09:48:18 UTC
README
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); });