Answer the question
In order to leave comments, you need to log in
How to make multi-user authorization in yii2?
Hello, I'm trying to make a yii2 restfull api with different users. from different tables in the database.
I use
QueryParamAuth, via access-token
I wrote
'user' => [
'class' => 'yii\web\User',
'identityClass' => 'app\models\Members',
'enableAutoLogin' => true,
' enableSession' => false,
],
'partner' => [
'class' => 'yii\web\User',
'identityClass' => 'app\models\Partners',
'enableAutoLogin' => true,
'enableSession'
made models. controllers made, I can log in. but the problem is with authentication. when I try to make a request for example to testController
public function behaviors()
{
return [
'authenticator' => [
'class' => QueryParamAuth::className()
],
then 'identityClass' => 'app\models\Members' is always called,
how to distinguish for example on different controllers, there were different identityClass?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question