I've been looking around the Internet but I cannot find anything related to my specific case online.
Let's assume there are 2 web applications. wa1
and wa2
. wa1
is written in PHP, located on domain1.com
and wa2
is written in Python, located on domain2.com
. There is a common database user_info
which stores user information such as usernames and passwords, and another database user_logged_in
which lists users and their sessions.
The user will authenticate through wa1
. How can I check if the user is authenticated in wa2
, if I cannot use remote MySQL to access the user_logged_in
database? Is it possible to set a cookie such that the site on domain2.com
can read the cookie set by domain1.com
?
If I got it right, I believe that you need a Single Sign On solution.
I'd recommend that you take a look at OpenID Connect specifications.
In this scenario you will need to add a third "app", which is going to be the responsible for issuing tokens to authenticated users (some sort of Identity Server). All the user related information will be stored and managed by this service.
The apps themselves will rely on the Tokens in order to check if there's a valid user and they can fetch user information from the Identity Server.
A great option for that is IdentityServer, which is open-source: https://identityserver.github.io/Documentation/
Their documentation is very good and will give you a more in-depth explanation.
Hope it helps.