Transfer cookies to subdomains located on different servers, implemented using PHP
<p>How to pass cookies when the subdomain is on a different server? <br /><br />Basically, the main domain is at siteground and the subdomain is at softr.io. <br /><br />I am using this for authentication, so when someone logs into the main domain, he/she can also access the login session on the subdomain. <br /><br />softr.io cannot add PHP code, so I can only use JavaScript on the subdomain. <br /><br />I used the following cookie code:</p><p><br /></p>
<p><code>setcookie($cookie_name, $cookie_value, $expiration_time, '/', $subdomain, true, true);</code></p>
<p>It shows the cookie in the application tab of the developer tools, but is not accessible in JavaScript via document.cookie. <br /><br />Is there anyone here who has tried this type of task and can guide me. <br /><br />I researched for hours but couldn't figure it out. </p><p><br /></p>