Skip to content

Commit

Permalink
Merge pull request #147 from filsh/readme-updates
Browse files Browse the repository at this point in the history
fix: updated README.md
  • Loading branch information
varp authored Aug 4, 2020
2 parents 155cd7e + 4573d99 commit 2b496cb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,17 @@ To use this extension, simply add the following code in your application config

```common\models\User``` - user model implementing an interface ```\OAuth2\Storage\UserCredentialsInterface```, so the oauth2 credentials data stored in user table

Additional OAuth2 Flags:
You can pass additional OAuth2 Server Options by setting `options` property on the module. Some of them are implemented as standalone properties on the module: `tokenParamName`, `tokenAccessLifetime`, `useJwtToken`. For a full list of the supported options go to the - [source code](https://github.com/bshaffer/oauth2-server-php/blob/5a0c8000d4763b276919e2106f54eddda6bc50fa/src/OAuth2/Server.php#L162).

```enforceState``` - Flag that switch that state controller should allow to use "state" param in the "Authorization Code" Grant Type

```allowImplicit``` - Flag that switch that controller should allow the "implicit" grant type

The next step your shold run migration
The next step you should run migration

```php
yii migrate --migrationPath=@vendor/filsh/yii2-oauth2-server/migrations
```

this migration create the oauth2 database scheme and insert test user credentials ```testclient:testpass``` for ```http://fake/```
this migration creates the oauth2 database scheme and insert test user credentials ```testclient:testpass``` for ```http://fake/```

add url rule to urlManager

Expand Down Expand Up @@ -142,7 +140,7 @@ class SiteController extends Controller
}
```

Also, if you set ```allowImplicit => true``` you can use Implicit Grant Type - [see more](http://bshaffer.github.io/oauth2-server-php-docs/grant-types/implicit/)
Also, if you set ```allow_implicit => true``` in the ```options``` property of the module, you can use Implicit Grant Type - [see more](http://bshaffer.github.io/oauth2-server-php-docs/grant-types/implicit/)

Request example:

Expand Down
8 changes: 4 additions & 4 deletions src/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,16 @@ class Module extends \yii\base\Module
* @var string name of access token parameter
*/
public $tokenParamName;

/**
* @var type max access lifetime
*/
public $tokenAccessLifetime;
/**
* @var whether to use JWT tokens
*/
public $useJwtToken = false;//ADDED

public $useJwtToken = false;


/**
* @inheritdoc
*/
Expand Down Expand Up @@ -126,7 +126,7 @@ public function getServer()
$this,
$storages,
array_merge(array_filter([
'use_jwt_access_tokens' => $this->useJwtToken,//ADDED
'use_jwt_access_tokens' => $this->useJwtToken,
'token_param_name' => $this->tokenParamName,
'access_lifetime' => $this->tokenAccessLifetime,
/** add more ... */
Expand Down

0 comments on commit 2b496cb

Please sign in to comment.