Answer the question
In order to leave comments, you need to log in
Yii2, how to make pass-through authorization with another application or give away authorization?
Good afternoon!
Please tell me how to make pass-through authorization
Roughly speaking, there is localhost
when we go to this address, the YII2 application is launched with authorization , we
authorize and everything is OK
, but at the address localhost / app2 is no longer Yii2,
how can I transfer authorization from YII2 to app2?
tried the following
in app2 call do
// .. куча разного кода
// ..
defined('YII_ENV_DEV') or define('YII_ENV_DEV', false);
defined('YII_DEBUG') or define('YII_DEBUG', false);
defined('YII_ENV') or define('YII_ENV', 'prod');
$yii_home_dir = __DIR__ . '/../_yii/'.DIRECTORY_SEPARATOR;
require $yii_home_dir . 'vendor/yiisoft/yii2/Yii.php';
require $yii_home_dir . 'systembid/common/config/bootstrap.php';
$config = require($yii_home_dir . 'system1/frontend/config/config.php');
$r = new yii\web\Application($config);
echo '<pre>21'; print_r($r->runAction('auth/index'));die;[/code]
class AuthController extends \yii\rest\Controller
{
public function actionIndex(){
if(\Yii::$app->getUser()->isGuest)
return false;
return \Yii::$app->getUser()->identity;
}
}
Answer the question
In order to leave comments, you need to log in
How is authorization in localhost/app2? Where is the authorization token stored? If in the session, then you can cock the sign of authorization in the session in Yii2, and then throw it on app2. It all depends on the app2 organization
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question