Reputation: 935
I am using sails.js as backend / API and angular js as frontend.
The server and the client are on different domain.
When I authentify my user with passport, I set the session of sails with the user object.
Then when I am authentified and I start a new request from my front to list products, on my server (sails.js) req.user is undefined and in my session there is not the user I created.
How can I sort out this issue? I would like to setup the current user as a session on my backend to avoid retrieving it everytime with id. I will have better performance.
Any ideas?
Thanks,
Upvotes: 3
Views: 715
Reputation: 935
Ok I found the answer.
You need to add this line in angularjs app.js
$httpProvider.defaults.withCredentials = true;
Thanks
Upvotes: 2
Reputation: 3099
When you login/signup return the user data as API instead of using seasons.
Upvotes: 1