Yii2 Authentication for Yii1 Apps?

Hi Folks.

My question is about sharing logged-in status between Yii2 and Yii1 applications.

I have a Yii2 application that serves as the “gatekeeper” for registering/logging in to the site at mydomain.com. I set the domain and path for the cookies so that subdomain.mydomain.com, which has it’s own Yii2 application, uses the PHPSESSID, _csrf, and _identity cookies to determine whether the user was previously logged in and allows him through if so.

What I’m looking for is instruction on what I need to do to have othersubdomain.mydomain.com – which has a Yii1 application – recognize the same cookies and allow the user to continue if logged in by the top-level Yii2 application. I’m missing something.

I’m hopeful someone here can help me understand how Yii1 handles this differently then Yii2.

Thanks in advance.

Hi,

Will the user be redirected from yii1 site domain.com -> some.domain.com ?

I too had the same problem. I solved by passing a temporary hash key with the URL. and do the $model->login method based on the validation.

But for your case pls let me know the actual logic where the user prompted to connect yii2 -> yii1.x

Actually, this has changed a bit since I posted this message in the hope that I could solve it myself (to no avail.)

The gatekeeper (Yii2) is at domain.com. After users log in or register, they may surf to a (Yii1) web app hosted at subdomain.domain.com. I would like the Yii1 app to allow registration as it currently does, or let the user through if they have proper cookie credentials from the gatekeeper login. Both the gatekeeper (Yii2) and the app (Yii1) use the same database.

Any help would be GREATLY appreciated.