I am not able to get login, user event while using Web Service API exposed by me

Hi All,

While logging in through webservice api using this url using POST -

http://localhost:8080/elgg-1.8.19/services/api/rest/json?method=auth.gettoken&username=admin&password=adminPassword

I am not getting [login, user] event. I do not get to see this msg in my log file [Debug: customlogin_init called]

Whereas while logging in through web interface I am able to get [login, user] event.

Here is what I have in my plug-in -

function customlogin_init()

{

    //log2file: is my msg logging function

    log2file("Debug: customlogin_init called \n");
    
    elgg_register_plugin_hook_handler('action', 'login', 'customlogin_setdefaults');
}

function customlogin_setdefaults()
{
    log2file("Debug: customlogin_setdefaults \n");
    
    return true;
}

register_elgg_event_handler('login', 'user', 'customlogin_init');

 

Please suggest if I am doing something wrong.

 

Thank you all

  • This method returns web services token and doesn't call login, so no event emitted. Only call with the token to user token authenticated web services method will perform login (and it will do it for every request).

  • Thanks Pawel Sroka.

    But my intent is to modify few things in this process of getting auth token.

    Is it possible to write a hook that will modify the submitted username/password while requesting auth token?

     

    Thank you all.