auto login monitor

Get help from the community here.

Moderator: Developers

robertboyl
Posts: 10
Joined: Thu Jan 12, 2017 4:32 pm

auto login monitor

Postby robertboyl » Wed Oct 17, 2018 1:43 pm

Hello!

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.

Example

index.php?r=auth/login&username=xxx&password=

In new GO this is not possible, right?

Thank you.
domain2001
Posts: 4
Joined: Sat Sep 14, 2019 5:37 pm

Re: auto login monitor

Postby domain2001 » Fri Sep 20, 2019 5:44 pm

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?
mschering
Site Admin
Site Admin
Posts: 8318
Joined: Tue Apr 20, 2004 1:06 pm
Location: The Netherlands - Den Bosch
Contact:

Re: auto login monitor

Postby mschering » Mon Sep 23, 2019 11:40 am

You have to create an access token by logging in to /api/auth.php. Then post "accessToken" to /index.php:


https://groupoffice.readthedocs.io/en/latest/developer/building-a-server-module.html#authenticate
Best regards,

Merijn Schering
Intermesh
robertboyl
Posts: 10
Joined: Thu Jan 12, 2017 4:32 pm

Re: auto login monitor

Postby robertboyl » Thu Sep 26, 2019 10:36 am

Thank you, Merijn!

PS - as time permits, pls check the feature requests in this forum.
rob
Posts: 29
Joined: Thu Feb 18, 2010 4:51 pm

Re: auto login monitor

Postby rob » Tue Oct 01, 2019 9:56 pm

Here is a function to get an accessToken per PHP:
  • -
    function goAuth($user,$pass) {
    $auth_string = '{ "username":"'.$user.'", "password":"'.$pass.'" }';
    $url = 'http://192.168.1.1/go/api/auth.php';
    $curl = curl_init($url);
    curl_setopt($curl,CURLOPT_HTTPHEADER,array('Content-type:application/json',));
    curl_setopt($curl,CURLOPT_POST, 1);
    curl_setopt($curl,CURLOPT_POSTFIELDS,$auth_string);
    curl_setopt($curl,CURLOPT_RETURNTRANSFER, 1);
    $response = curl_exec($curl);
    curl_close($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
mschering
Site Admin
Site Admin
Posts: 8318
Joined: Tue Apr 20, 2004 1:06 pm
Location: The Netherlands - Den Bosch
Contact:

Re: auto login monitor

Postby mschering » Wed Oct 02, 2019 7:15 am

Thanks for sharing. Don't understand why json_decode wouldn't work though.
Best regards,

Merijn Schering
Intermesh

Who is online

Users browsing this forum: No registered users and 7 guests

cron