Logging in via external page

indepth

Member
I've been working with several of the custom API and SDK scripts to try to accomplish some basic tasks. Unfortunately the two that are most useful to my exact needs are both 1-2 releases outdated.

I've managed to get everything I need working EXCEPT the ability to login from an external page (on the same site/server).

Does anyone have a routine written that will accomplish this?

I am trying to rework this login function from XenAPI, but I can't seem to get it to work.

Also, does the newest version of Xenforo manage the session in the database by default? I was thinking that might be the issue with this not working.

Code:
    public function login($username, $password, $ip_address)
    {
        $this->setMethod('login');
        $this->setParameters(array(
            'username'   => $username,
            'password'   => $password,
            'ip_address' => $ip_address
        ));
        $response = $this->execute();
        $success = setcookie(
            $response['cookie_name'],
            $response['cookie_id'],
            $response['cookie_expiration'],
            $response['cookie_path'],
            $response['cookie_domain'],
            $response['cookie_secure'],
            TRUE
        );
        return $success;
    }
 

indepth

Member
Whelp, nevermind. It now seems to magically be working. Not sure if I changed a setting that enabled it, or if there was an incorrect link to or missing file for the api.

But appears to be working for the time being.
 
Last edited:

indepth

Member
UPDATE: Sorry for flip flopping, but now it appears this isn't actually working properly.

This has to be a cookie management issue. Now the external login and logout works, BUT the normal xenforo login fails. It says the login is successful but never actually logs the user in.

Clearing the site cookies fixes the problem temporarily, but it comes right back on the next attempted login from the external script.

I'm about out of time on this project. If there is an experienced xenforo developer who would be willing to work on this problem with me I'd be happy to pay. Please DM me if you are interested.
 
Top