Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

napster21's avatar

How to mantain the session when user travels from Laravel website to angular 2 website

Suppose I have a website www.website.com which is built on Laravel Framework. This website is a full-fledged website with Frontend Views. Also, I have another sub-domain called "sub-domain.website.com which is built with Angular2 Framework.

the sub-domain website i.e., the angular2 website is using API from the main website.... thus the main website also acts as a backend engine driver for Angular2 application.

Now I am looking for login/logout functionality in both the websites (domain & sub-domain) but I don't want the user to lose the session when traveling from domain to sub-domain.

I want if the user logged in any of the websites, say Laravel, now when the user travels to sub-domain, it should not ask the user to sign in again.

How can I do that??

0 likes
1 reply
mvd's avatar

Hi @napster21

I think you are looking for SSO (Single sign-on).

Single sign-on (SSO) is a property of access control of multiple related, yet independent, software systems. With this property, a user logs in with a single ID and password to gain access to any of several related systems

More info: https://en.wikipedia.org/wiki/Single_sign-on

I'm not familiar with SSO and Laravel but there are some solutions such as https://github.com/ramdannur/laravel-sso-passport

Please or to participate in this conversation.