1. Go to this page and download the library: Download tecnocen/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/ */
use OAuth2\Storage\UserCredentialsInterface;
use tecnocen\oauth2server\RevokeAccessTokenInterface;
use tecnocen\oauth2server\RevokeAccessTokenTrait;
class User extend \yii\db\ActiveRecord implement
UserCredentialsInterface,
RevokeAccessTokenInterface
{
use RevokeAccessTokenTrait; // optional, trait with default implementation.
// rest of the class.
}
public function behaviors()
{
return [
'revokeToken' => [
'class' => \tecnocen\oauth2server\filters\RevokeAccessToken::class,
// optional only revoke the token if it has any of the following
// scopes. if not defined it will always revoke the token.
'scopes' => ['author', 'seller'],
// optional whether or not revoke all tokens or just the active one
'revokeAll' => true,
// optional if non authenticated users are permited.
'allowGuests' => true,
// which actions this behavior applies to.
'only' => ['create', 'update'],
]
];
}
php composer.phar
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.