vladimixz / yii2-rest-component
Simple component for creating rest api auth
This package's canonical repository appears to be gone and the package has been frozen as a result.
Installs: 131
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 3
Forks: 0
Open Issues: 0
Type:component
Requires
- php: >=5.3.0
- abraham/twitteroauth: ~0.7.2
- facebook/graph-sdk: ~5.0
- firebase/php-jwt: ^4.0
README
yii2 rest component
Add this to params.php config
'salt' => ''
'apiAuthCredentials' => [
'facebook' => [
'default_graph_version' => 'v2.8',
'app_id' => '',
'app_secret' => '',
],
'twitter' => [
'consumerKey' => '',
'consumerSecret' => '',
],
'tables' => [
'user' => '',
'userDevice' => ''
],
'jwtExp' => 60*60*24*30 //month
],
Add JSON parser to your web config
'parsers' => [
'application/json' => 'yii\web\JsonParser',
]
In terminal go to project folder and run
php composer.phar require vladimixz/yii2-rest-component
php composer.phar run-script install -d ./vendor/vladimixz/yii2-rest-component/
In controller you can use component in behaviour as authenticator
/**
* @inheritdoc
*/
public function behaviors () {
return [
'authenticator' => [
'registerAction' => 'register',
'loginAction' => 'login',
'class' => BearerAuth::className(),
'except' => []
]
];
}