The complete registration and login system in Mena stack with angular nodejs passport and using the Cors Origin request.
Here there are two services are running on separate port because lot of problems occur when you use this kind of mechanism using the cross-origin request.
we are talking about CORS origin and the Cookie based authentication using passport.js but remember that the course here is on different port number not the domain.
so if you have a completely separate domain that is your Express app is running on some separate IP and your angular on a separate server then you will not be able to use this cookie based authentication.
Because browsers do not allow to save the cookies coming from different domain as per the security policies so if you have two separate services that running on separate domain that is your Express app completely on a different server and your angular on a different server use web token based authentication.
If you are running on the same IP on the same domain even if you are using cross-origin request on different ports
you are very much welcomed by passport.js to use the cookie based authentication