Page 1 of 1

auto login monitor

Posted: Wed Oct 17, 2018 1:43 pm
by robertboyl

In older GO, we used to have a URL that would also login to GO, this way we could monitor if login to GO is working.



In new GO this is not possible, right?

Thank you.

Re: auto login monitor

Posted: Fri Sep 20, 2019 5:44 pm
by domain2001
Hello everybody, I have the same question.

Is there a solution to the problem or a new URL in 6.4?

Can it be that you no longer need to pass username and password in plain text, but encrypted?

Re: auto login monitor

Posted: Mon Sep 23, 2019 11:40 am
by mschering
You have to create an access token by logging in to /api/auth.php. Then post "accessToken" to /index.php:

Re: auto login monitor

Posted: Thu Sep 26, 2019 10:36 am
by robertboyl
Thank you, Merijn!

PS - as time permits, pls check the feature requests in this forum.

Re: auto login monitor

Posted: Tue Oct 01, 2019 9:56 pm
by rob
Here is a function to get an accessToken per PHP:
  • -
    function goAuth($user,$pass) {
    $auth_string = '{ "username":"'.$user.'", "password":"'.$pass.'" }';
    $url = '';
    $curl = curl_init($url);
    curl_setopt($curl,CURLOPT_POST, 1);
    curl_setopt($curl,CURLOPT_RETURNTRANSFER, 1);
    $response = curl_exec($curl);
    $aTok = explode('accessToken":"',$response,2);
    return explode('","',$aTok[1],2)[0];
The $url-variable has to be the full URI to GO-path to operate!
The method "json_decode" to parse the curl response had no success in my environment, so I had to parse it with these rather ugly explodes - but here it's working good.

Unfortunately the old GO config-variable $config['logout_url'] does not work anymore. So if you're logging out, you must go back by hand! Would be nice, to reactivate this setting dear developers!

Greetings Rob

Re: auto login monitor

Posted: Wed Oct 02, 2019 7:15 am
by mschering
Thanks for sharing. Don't understand why json_decode wouldn't work though.