I am using Okta for authentication and the OKTA hosted login page and OneLogin/SAML. Chrome starts up Okta and the user authenticates. I then take their authenticated email and stick it a cookie it in the saml's index.php. Onelogin spawns my application, looks for the cookie, and uses the cookie to determine the id of the user. This works. Now I need to have AWS start up the Okta login page. Same procedure. But now I want both the email address and the token in the cookie. Later AWS requires a handshake between my app and itself. So AWS sends (Posts) a token to OneLogin and my app needs to use that token to do the handshake. I am trying to add a second cookie in which to send the cookie to my app too.
But I can't seem to send a 2nd cookie.There are many posts about this. I tried creating two cookies cookie_email and cookie_token in the index.html in saml but only the cookie email arrives when my app looks for it. It seems sending two cookies is prohibited. I then tried stuffing both values in a single string and sticking that string in the cookie, but this doesn't seem to work. When I look with the debugger$_SESSION['samlUserdata'] is blank.
Is there any other way to send the values from one app to another? Perhaps via a file? I tried using $_Session but since Onelogin and my app are not connected, other than by the cookie, this doesn't seem to work. Here is the code I use to create the "dual cookie":
Blockquote $value="userid=".$_SESSION['samlUserdata']['email'][0]."; token=".$_POST['x-amzn-marketplace-token']; $iRc=setcookie("cookie_email", $value, time() + (86400 * 30), "/");
source https://stackoverflow.com/questions/76749730/sending-two-cookies-from-one-app-to-another
No comments:
Post a Comment