Cookies set in this manor are specific to not only the domain but the full path of the URL. Since the SSO response runs on a url like https://stack.q2developer.com/sdk/partner/mobilews/sso/vendor/3 ... the cookie will only be available at that full URL.
Instead, the "path" parameter should be added to the cookie string to set it at the root level for that domain:
document.cookie = "{}={}; path=/";