thomas.rodriguez Posted June 11, 2012 Share Posted June 11, 2012 I followed the API documentation to validate a login [1], which works fine for me. However, when I set the session variables $_SESSION['uid'] and $_SESSION['upw'] as described there, with the returned userid and passwordhash from the validate login API call, I am not automatically logged in to WHMCS. Via the forums I found that the passwordhash is (or was once?) computed as follows: $_SESSION['upw'] = md5($userRow['id'] . $userRow['password'] . $_SERVER['REMOTE_ADDR']); Because the API is not called from the clients IP but a servers IP, I suppose that this might cause it not to work. However, even if I create the $_SESSION['upw'] hash as described above I am not automatically logged in. To verify the hashs I obtained the $_SESSION['upw'] variable after a regular login to WHMCS which indeed turns out to be different to the one I am returned by the API call validate login, as well as the manual construction. Later I discovered AutoAuth [3]. It works for the first page of WHMCS that I enter. However, when I go to other pages of WHMCS the login seems to get lost again. I even disabled Session IP Checking in the general settings -> security, without success. Also, the timestamp that I use with AutoAuth has the same time as the server time. Does someone know how this can be succesfully done? Or how I can debug this process in any way in more detail? Thanks 0 Quote Link to comment Share on other sites More sharing options...
jclarke Posted June 11, 2012 Share Posted June 11, 2012 I wouldn't use the session based authentication, that will only really work if the other application is on the same domain unless you tweak the cookie to save under the whmcs domain and can just be difficult to work with in general. That being said, your best bet is to continue to try and get AutoAuth to work instead. Make sure you have disabled your other code that is changing the session variables just in case that is conflicting with AutoAuth and exit out of your browser completely to clear out any session cookies and try your autoauth again. 0 Quote Link to comment Share on other sites More sharing options...
thomas.rodriguez Posted June 11, 2012 Author Share Posted June 11, 2012 (edited) Thanks for your help. I tried to clear my browser data, session cookies etc. but without success. I do put some other variables from external in the $_SESSION, but after I go from my site to WHMCS, WHMCS will overwrite any variables that may have conflicting names with my site, right? So if then I have an issue in WHMCS, I don't think it can be because of a conflict there? Why does it work for the first page I enter in WHMCS, and a second one the session information is lost? Any ideas on this detail? Here are the $_SESSION variables of the first site: array(9) { ["email"]=> &string(17) "some@one.net" ["uid"]=> &string(1) "7" ["upw"]=> &string(32) "a4cd87549233cf900f8d83e617206e8d" ["Language"]=> &string(7) "english" ["calinkupdatecc"]=> &int(0) ["calinkupdatesq"]=> &int(0) } And here, of another one if I continue to navigate in WHMCS: array(3) { ["calinkupdatecc"]=> &int(0) ["calinkupdatesq"]=> &int(0) ["loginurlredirect"]=> &string(36) "/dach/clientarea.php?action=products" } Edited June 11, 2012 by thomas.rodriguez 0 Quote Link to comment Share on other sites More sharing options...
thomas.rodriguez Posted June 11, 2012 Author Share Posted June 11, 2012 @jclarke: Do you use AutoAuth in the most recent version of WHMCS? Or anybody else? 0 Quote Link to comment Share on other sites More sharing options...
jclarke Posted June 11, 2012 Share Posted June 11, 2012 Yeah, I use AutoAuth with WHMCS 5.0.3 and it works great. I just followed the instructions here: http://docs.whmcs.com/AutoAuth. 0 Quote Link to comment Share on other sites More sharing options...
thomas.rodriguez Posted June 12, 2012 Author Share Posted June 12, 2012 In case somebody gets into similar trouble: In my case the link to dologin.php of autoauth did not exactly match the WHMCS System URL (www. was missing). 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.