Inheritance: extends CI_Controller
 /**
  * constructor
  *
  * @param object $app app object.
  * @return none.
  */
 public function __construct($app, $callback_page = 'login')
 {
     parent::__construct($app, 'Facebook');
     // TODO: these should be fetched from the site settings for this plugin (e.g. $app->site->get('oauth', 'client_id'); )
     $clientId = '<CLIENT ID>';
     $clientSecret = '<SECRET>';
     $graphApiVersion = "";
     // probably "v2.0"
     $this->_provider = new \League\OAuth2\Client\Provider\Facebook(['clientId' => $clientId, 'clientSecret' => $clientSecret, 'graphApiVersion' => $graphApiVersion, 'redirectUri' => $this->_app->site->uri['public'] . "/oauth/facebook/{$callback_page}"]);
     //        $this->_provider->fields = $oaFields;
 }
 /**
  * constructor
  *
  * @param object $app app object.
  * @return none.
  */
 public function __construct($app, $callback_page = 'login')
 {
     parent::__construct($app, 'LinkedIn');
     // TODO: these should be fetched from the site settings for this plugin (e.g. $app->site->get('oauth', 'client_id'); )
     $clientId = '<CLIENT ID>';
     $clientSecret = '<SECRET>';
     $scopes = ['r_basicprofile', 'r_emailaddress'];
     $oaFields = ['id', 'email-address', 'first-name', 'last-name', 'headline', 'location', 'industry', 'picture-url', 'public-profile-url', 'summary', 'specialties', 'positions'];
     //        $this->_provider = new \League\OAuth2\Client\Provider\LinkedIn([
     //            'clientId' => $clientId,
     //            'clientSecret' => $clientSecret,
     //            'redirectUri' => $this->_app->site->uri['public'] . "/oauth/linkedin/$callback_page",
     //            'scopes' => $scopes]);
     $this->_provider = new \League\OAuth2\Client\Provider\LinkedIn(['clientId' => $clientId, 'clientSecret' => $clientSecret, 'redirectUri' => $this->_app->site->uri['public'] . "/oauth/linkedin/{$callback_page}"]);
     $this->_provider->fields = $oaFields;
 }
<?php

return ['database' => 'default', 'grant_types' => ['password' => ['class' => '\\League\\OAuth2\\Server\\Grant\\PasswordGrant', 'access_token_ttl' => 7200, 'callback' => function ($username, $password) {
    // oauth2 password 授权方式,回调
    return OAuthController::passwordVerify($username, $password);
}], 'refresh_token' => ['class' => 'League\\OAuth2\\Server\\Grant\\RefreshTokenGrant', 'access_token_ttl' => 7200, 'refresh_token_ttl' => 7200, 'rotate_refresh_tokens' => true]], 'token_type' => 'League\\OAuth2\\Server\\TokenType\\Bearer', 'state_param' => false, 'scope_param' => false, 'scope_delimiter' => ',', 'default_scope' => null, 'access_token_ttl' => 3600, 'limit_clients_to_grants' => false, 'limit_clients_to_scopes' => false, 'limit_scopes_to_grants' => false, 'http_headers_only' => false];