Search code examples
javascriptsessionsails.jssession-cookies

sails.js no userId when a route is called by browser


I have some asset (js file) that I create dynamically in a sails app (according to the user), in order to do so I created an action and bound it to a route.

when I call this route directly, everything works as expected. but when I try to load it in an HTML file with tag, it seems it doesn't recognize me as logged in.

how can I get the user to be recognized that way?

Thanks.


Solution

  • found the issue:

    I logged in through localhost that created a session for this host, while loading the script in my html with 127.0.0.1, so it didn't use the session created for localhost.

    once I changed my html to load with the script with localhost, I get recognized.