yii2

Redirect after login with YII2


For example:
1. A user is trying to access to mypage.php?param=1.
2. He can not to access, because he is not authenticated.
3. So, He try to log with his google account.
4. He have a access successfully.
5. Now, I would like to redirect to that user to mypage.php?param=1.


Solution

  • Yii support user redirect url when they were redirected by permission rules. You can find at : Yii2::$app->user->returnUrl and check then redirect if it does not empty.