1. Go to this page and download the library: Download macfly/yii2-oauth2-server 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/ */
macfly / yii2-oauth2-server example snippets
'modules'=>[
//other modules .....
'oauth2' => [
'class' => 'macfly\oauth2server\Module',
'tokenParamName' => 'accessToken',
'tokenAccessLifetime' => 3600 * 24, // Default token lifetime
'userModel' => 'app\models\User',
'userAttributes' => [ // List of user attributes you want to provide through the /oauth2/user api call
'id',
'username',
'email',
],
]
// yii2-oauth2-server is using the kartik\datecontrol\Module so you should define the configuration of the module
// See more details at http://demos.krajee.com/datecontrol
'datecontrol' => [
'class' => 'kartik\datecontrol\Module',
'ajaxConversion' => true,
'autoWidget' => true,
'saveTimezone' => 'UTC',
],
],