I created two Mean.io applications in the .com domain and in sub.domain.com respectively, and everything works as expected in both, but the problem is that the one that is in the subdomain (sub.domain.com), should know if the user is registered in the main application (domain.com).
I know that the passport processes the sessions and knows if the user is registered, because he creates a user object in req for each request in express.js:
if (req.user) { // logged in } else { // not logged in }
The inconvenient thing here is that this approach works from the inside of the domain, but not from the outside. In other words, if I make a backend request as follows:
$http.get('/api/users/me').success(this.onIdentity.bind(this));
from domain.com, it will be filled with user data, but if I make the same request directly from the browser, for example, it will return null.
I need to understand how to transfer this information across domains? And if every time this request is executed $http.get('/api/users/me').success(this.onIdentity.bind(this)); Is the information transferred to the backend?
source share