I am creating a web portal where users have their emails pulled from our Zimbra Mail Server and displayed on the portal, however, I have ran into some strange issue using the Zimbra Preauth. Essentially, the preauth works perfectly on my LocalHost but when accessed from the live server, it gives a HTTP 500 error. I suspect it is an issue to do with the timestamp that forms part of the preauth url. "Problem accessing /service/preauth. Reason: For input string: "1.365843887E 12" The code I used for generating the preauth URL is like so:
$PREAUTH_KEY = [My Key];
$WEB_MAIL_PREAUTH_URL = "http://myserver/service/preauth";
$timestamp=time()*1000;
$preauthToken = hash_hmac("sha1",$email."|name|0|".$timestamp,$PREAUTH_KEY);
$preauthURL = $WEB_MAIL_PREAUTH_URL."?account=".$email."&by=name×tamp=".$timestamp."&expires=0&preauth=".$preauthToken."&redirectURL=/zimbra/h/";
I was able to recreate the problem on my LocalHost development machine by assigning "wrong" values to the $timestamp
variable above. So, what are the possible reasons that could make Zimbra preauth "break" when working from the live server? Thanks.