Skip to content
Joseba Juániz edited this page Sep 10, 2015 · 10 revisions

NOTE : lots of new things here, BUT ONLY FOR BASIC INSTALLATION ONLY. FOR CHANGING BEHAVIORS AND ALL THAT, THE SPECIFIC GRANTS.

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist filsh/yii2-oauth2-server "*"

or add

"filsh/yii2-oauth2-server": "*"

Into the require section of your composer.json file.

To use this extension, you simply have to add the following code in your application configuration:

    'modules' => [
           'oauth2' => [
                'class' => 'filsh\yii2\oauth2server\Module',
           ],
            ...
       ]
  • If you have a Basic Yii2 App installation the configuration file should be stored at config/web.php
  • If you have an Advanced Yii2 App installation, the configuration file will depend of which tier you want to adapt as an API server, but should be stored in (frontend|backend|common)/config/main.php file.

The next step your shold run migration

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/

add url rule to urlManager

'urlManager' => [
    'rules' => [
        'POST oauth2/<action:\w+>' => 'oauth2/default/<action>',
        ...
    ]
]

Clone this wiki locally