Authenticated methods don't work as I think they should?

Hi!! this is my first post, I have been following some of you for a few months and now that I got my hands dirty I need some backup :(

I am developing an iPhone application for ELGG, it will be my final university project :) and its going pretty good so far with Dashcode/iPhone but on the opposite, with ELGG API, I am having trouble.

I am using ELGG 1.5, I've tried 1.6 and 1.7 but both returns me to the main page without any message using my current anonymus functions, no idea why!

Ok, here is my simple question:

If I create this simple function:

function login() {
        expose_function('login', 'check_login', array(
                'username' => array('type' => 'string'),
                'password' => array('type' => 'string')
        ), "", "GET", true, false);

(last two boolean parameters are for required_auth_token and the other one is anonymus call method no? )


With the function checklogin:

function check_login($username, $password) {

        $persistent = "1";
        $result = false;
        if (!empty($username) && !empty($password)) {
                if ($user = authenticate($username,$password)) {
                        $result = login($user, $persistent);
        return $result;

I am using apiadmin plugin to get de public key.

If I pass to the method de api_key like it says here, it tells me:

"No authentication methods were found that could authenticate this API request."

What I am missing?

Thank you for your time!


  • The REST API changed between Elgg 1.6 and Elgg 1.7. The biggest change is that the REST API had tons of bugs before Elgg 1.7. Another change is that the parameters for expose_function() changed. I really recommend working with 1.7 since it is so much more stable.

    Another point is that right now the REST API does not support returning false as a successful result from an exposed function. Returning false is equivalent to saying the function failed and an error message will be returned. I'm still debating on whether that is a good idea.