I have a Sails application and the authentication using passport works just fine when it is a single domain app (steps as in Passport Doc). I am now trying to convert the app to using subdomains (foo.example.com, bar.example.com), all of which points to the same sails server. The session works only for the same sub-domain, for example, if the user is logging in from foo.example.com, then the user is able to access pages under the same sub domain...but not under bar.example.com. req.isAuthenticated() is returning false when redirecting to a subdomain different from the one that was authenticated.
How can I ensure the authentication is across the sub-domains? Any help is much appreciated.
I am using Sails@1.1.0/passport@0.4.0.