There's a good chance that the site sets a cookie. If so, you may be able to check it.
This should show any cookies in the MODX error log:
$modx->log(modX::LOG_LEVEL_ERROR, 'COOKIES:
' . print_r($_COOKIES, true));
Put it just above the if($authenticated) line.
[ed. note: BobRay last edited this post 9 years, 9 months ago.]
Sorry, the second line here had a missing final ')'. That's what was stopping things. It should be (fixed above):
$modx->log(modX::LOG_LEVEL_ERROR, 'COOKIES:
' . print_r($_COOKIES, true));
I'm not sure the iFrame is the issue. The remote login site's cookies are stored on the users local computer, in a section for cookies from that remote domain. I should have realized your script is running in a different domain, so the browser isn't going to let you have them.
I don't suppose the remote login site has OAuth capability? That would be ideal for what you're doing. The OAuth server is where the user logs in, and other servers can query it for the results.
I don't think this will work, but it's worth a try:
Put this tag in the iframe:
[[!GetUrl]]
Then create a snippet called GetUrl with this code:
$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
<?php
$msg = 'REQUEST_URI: ' . $_SERVER["REQUEST_URI"] .
'HOST: ' . $_SERVER["HTTP_HOST"] .
'SERVER_NAME: ' . $_SERVER["SERVER_NAME"] .
'REFERER" ' . $_SERVER["HTTP_REFERER"] .
'URI" ' . $_SERVER["REQUEST_URI"];
$modx->log->(modX::LOG_LEVEL_ERROR, $msg);
See if anything useful appears in the error log.
[ed. note: BobRay last edited this post 9 years, 9 months ago.]
No - nothing appears in the error log. All I get is what is expected from the plugin:
[2016-12-13 13:42:49] (ERROR @ /volume1/web/qpgc/core/cache/includes/elements/modplugin/8.include.cache.php : 61) Event: OnBeforeWebLogin -- Line x of plugin executing
[2016-12-13 13:42:49] (ERROR @ /volume1/web/qpgc/core/cache/includes/elements/modplugin/8.include.cache.php : 92) Event: OnWebAuthentication -- Line x of plugin executing