baiyicms/baidu

baidu.com OAuth2 Provider for Laravel Socialite

v1.0.1 2017-01-12 07:09 UTC

README

百度 OAuth2 账号连接 for Laravel 5.x.

Installation

  1. 安装 composer package:

     composer require baiyicms/baidu
    
  2. config/app.php 中 Laravel\Socialite\SocialiteServiceProvider 替换成 SocialiteProviders\Manager\ServiceProvider

  3. app/Providers/EventServiceProvider.php 中添加一个监听器:SocialiteProviders\Manager\SocialiteWasCalled,如果已存在则忽略;并添加监听响应事件:Baiyicms\Baidu\BaiduExtendSocialite@handle

    'SocialiteProviders\Manager\SocialiteWasCalled' => [
    	// ...
    	'Baiyicms\Baidu\BaiduExtendSocialite@handle',
    ],
    
  4. config/service.php 中添加一个配置项:

    'baidu' => [
    	'client_id'     => env('BAIDU_KEY'),
    	'client_secret' => env('BAIDU_SECRET'),
    	'redirect'      => env('BAIDU_REDIRECT_URL'),
    ],
    

Usage

详见官方文档 socialite 用法。

License

MIT License.