Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Yii2 - Filsh OAuth2 Server Installation

I am currently trying to install a Yii2 extension for implementing an OAuth2 server (https://github.com/Filsh/yii2-oauth2-server). However, I keep running on the error below:

Error page

Does anyone have an idea on how to install this extension. I followed the instructions given but there was no mention about that error.

like image 878
jackeblagare Avatar asked Sep 29 '22 20:09

jackeblagare


1 Answers

Satya is right. You need to configure oauth2 module as described on repo's description:

'oauth2' => [
   'class' => 'filsh\yii2\oauth2server\Module',
   'options' => [
      'token_param_name' => 'accessToken',
      'access_lifetime' => 3600 * 24
   ],
   'storageMap' => [
      'user_credentials' => 'common\models\User'
   ],
   'grantTypes' => [
      'client_credentials' => [
         'class' => 'OAuth2\GrantType\ClientCredentials',
         'allow_public_clients' => false
      ],
      'user_credentials' => [
         'class' => 'OAuth2\GrantType\UserCredentials'
      ],
      'refresh_token' => [
         'class' => 'OAuth2\GrantType\RefreshToken',
         'always_issue_new_refresh_token' => true
      ]
   ],
]

I've configured this extension successfully and created Yii2 Rest API template with OAuth2 server https://github.com/ikaras/yii2-oauth2-rest-template - feel free to use. Also this code has some demo data (examples of using) and support of scopes for controllers.

like image 58
CreatoR Avatar answered Oct 19 '22 09:10

CreatoR