0

I am working with Advanced Template of Yii framework 2.0. As we already know, There are the backend package and the frontend package separated from each other. I put the backend application in a subdomain and frontend in the main domain. Both packages use their own config file and share the same common/config/main.php file.

When I log in to the frontend, I am not automatically logged in to the backend which lives in the subdomain. How can I do to make user being logged in to the backend automatically after logging in to the frontend successfully?

Melon
  • 874
  • 8
  • 17
O Connor
  • 4,236
  • 15
  • 50
  • 91
  • Check this out: http://stackoverflow.com/questions/21693866/how-to-authenticate-users-from-two-yii-apps-on-the-same-server – Masiorama Jan 15 '15 at 10:34
  • @Masiorama: I just had a look at that article. Don't you think my case is a bit different since my issue is about main domain and sub domain. That article is about two application on the same one domain Or I just can use the same solution? – O Connor Jan 15 '15 at 10:57
  • It's a similar scenario, but indeed it is different because you need to handle other problems, like the cross-domain sharing of cookies (not possibile) and so on. But it is the right approach. For instance, to solve the cross-domain problem you could decide to create an authentication centralized in a third application and that use that for the backend and frontend... tell me if you need me to elaborate more. :) – Masiorama Jan 15 '15 at 11:02
  • For instance, about the cookies problem: http://stackoverflow.com/questions/3342140/cross-domain-cookies – Masiorama Jan 15 '15 at 11:07

0 Answers0