Changes
Title
unchanged
Use Single Login Session on All Your Yii2 Application/Repository Under Same Domain/Sub Domain
Category
unchanged
Tutorials
Yii version
unchanged
2.0
Tags
changed
session,login,single-login
Content
changed
There are multiple blog that shows how to use seperate login for yii2 application but in this article i will show you how to use a single login screen for all your YII2 Advanced, YII2 Basic, Application, It will also work when your domain on diffrent server or the same server.
Here are few Steps you need to follow ot achive this.
There are multiple blog that shows how to use seperate login for yii2 application but in this article i will show you how to use a single login screen for all your YII2 Advanced, YII2 Basic, Application, It will also work when your domain on diffrent server or the same server.[...]
Step 1 : Add this into your component inside
/path/common/config/main.php
```php
'components' => [
'user' => [[...]
```
Step 2: Add Session and Request into main-local.php
/path/common/config/main-local.php
```php
'components' => [
'session' => [[...]
/path/frontend/config/main-local.php
/path/backend/config/main-local.php
```php
'components' => [
'request' => [[...]
Step 4: Note Somethign that you also have and console application so update session, user,and request into the main-local.php of your console application
/path/console/config/main-local.php
```php
'components' => [
'session' => null,[...]
Step 1: Update You main-local.php of basic template
/path/basic-app/config/main-local.php
```php
'components' => [
'session' => [
'cookieParams' => [
'path' => '/',[...]