The main task is to find out from which user the data comes, perhaps the approach that I use in this example will not work.
I try to establish session for the user from one site in another, there is site1 written on php and site2 written on nodejs. C site1 I send ajax request to the url http: // site2: 3000 / send , session is established there.
$.ajax({ type: 'GET', url: "http://site2:3000/send", dataType: 'html', success: function (data) { $.ajax({ type: 'GET', url: "http://site2:3000/test-send", dataType: 'html', success: function (data) { alert(data); } }); } }); But as soon as I turn to the following URL http: // site2: 3000 / test-send, the session that was set up for http: // site2: 3000 / send is no more. The nodejs code itself is next
router.get('/send', function(req, res, next) { req.session.test_req = "red"; console.log(req.session.test_req); // После обращения через site1 сессия в консоли есть res.end();}); router.get('/test-send', function(req, res, next) { console.log(req.session.test_req); // После обращения через site1 сессии здесь уже нет res.end();}); If you access site2 directly through the browser, then the sessions are set correctly and saved.
Is it possible to solve the problem in such a way that to create a session for the user by sending an ajax request via another service or is some other solution necessary?
site2:3000from their point of view is a third-party site) in order to protect the user from being tracked. - Pavel Mayorov