I ran
a cURL on my Terminal
Note : state = b4cf8fe7-aa68-4b25-8f9a-03a67fb420c7
curl -c session_cookies.txt "https://login.uat.site.be/openid/oauth/authorize?client_id=site&state=b4cf8fe7-aa68-4b25-8f9a-03a67fb420c7&nonce5ba13e5f-256d-425d-808b-1e05d2aa3d72&response_type=code&claims=%7B%22id_token%22%3A%7B%22http%3A%2F%2Fsite.be%2Fclaims%2Froles%22%3Anull%7D%7D" 2>/dev/null| curl -v -b session_cookies.txt -L -H "Content-Type: application/x-www-form-urlencoded" -v -d 'j_username=manager-sitelogin@gmail.com&j_password=site1' "https://login.uat.site.be/openid/login.do" 2>&1 >/dev/null | grep Location | grep code=
I got this reponse back
< Location: https://testserver.sitenets.com/user/secure/dashboard?code=zvk495dsnq1ycLKZgN8oqfFxQogg2oql&state=b4cf8fe7-aa68-4b25-8f9a-03a67fb420c7
Note : state = b4cf8fe7-aa68-4b25-8f9a-03a67fb420c7
PHP
Note : state = b4cf8fe7-aa68-4b25-8f9a-03a67fb420c7
$cmd = 'curl -c session_cookies.txt "https://login.uat.site.be/openid/oauth/authorize?client_id=site&state=b4cf8fe7-aa68-4b25-8f9a-03a67fb420c7&nonce5ba13e5f-256d-425d-808b-1e05d2aa3d72&response_type=code&claims=%7B%22id_token%22%3A%7B%22http%3A%2F%2Fsite.be%2Fclaims%2Froles%22%3Anull%7D%7D" 2>/dev/null| curl -v -b session_cookies.txt -L -H "Content-Type: application/x-www-form-urlencoded" -v -d 'j_username=manager-sitelogin@gmail.com&j_password=site1' "https://login.uat.site.be/openid/login.do" 2>&1 >/dev/null | grep Location | grep code=';
$result = shell_exec($cmd);
dd($result);
Note : state != b4cf8fe7-aa68-4b25-8f9a-03a67fb420c7
Note : state = 12345678-256d-425d-808b-1e05d2aa3d72
< Location: https://testserver.sitenets.com/user/secure/dashboard?code=zvk495dsnq1ycLKZgN8oqfFxQogg2oql&state=12345678-256d-425d-808b-1e05d2aa3d72
When I run shell_exec($cmd), my state always come back different the one that I submitted. How is this possible ?
Is it caching somewhere on my local machine ? Should I clear something ?
Why shell_exec()
return slightly different result than if I would have do it directly on Terminal ?
I even tried using exec()
, same result.
How would one go about and debug this further ?
What elses should I look into ?
I'm opening to any suggestions at this moment.
Any hints / suggestions / helps on this be will be much appreciated !