i’m not sure if i’m doing something wrong in my code or if my desired action is just not allowed in the standards…i’m trying to set a cookie on my localhost then redirect the user off to another domain. (for some background on why i would want to do this: as part of the oauth 1.0 signin process i want to set the oauth state then redirect the user off to the service provider to signin; but this is not really relevant to my question – it just may be useful in case someone wants to suggest a better way to do what i am trying to do…)
here is a simpified version of the relevant piece of my php code:
setcookie('oauth_state', 'one', time() + 60*60, '/', 'localhost', false, false);
header("Location: http://google.com/");
exit;
i’m testing on firefox 10.0.2 on ubuntu and no cookie at localhost is being set. what am i doing wrong?
Cookies are domain specific. So if you set the cookie in one domain and then redirect to a new domain, then the cookie you previously set will not be visible.