How to externally authenticate an Xenforo User for Bridge

I'm trying to create a bridge between Xenforo and another application I want to use, but I am stuck on how Xenforo stores the user credentials.

Using a generic forum bridge template to start from, I've gotten most of it working, except the authentication part. I'm not sure where to go from here to fix this code:

public function get_user_password($intUserID, $arrGroups){
        global $password2;
        $query2 = $this->db->query("SELECT user_id, data, remember_key FROM ".$this->prefix."user_authenticate WHERE user_id='".$this->db->escape($intUserID)."'");
        $result2 = $this->db->fetch_row($query2);
        $password2 = $query2['data'];
public function check_password($password2, $hash, $strSalt = '', $boolUseHash){
        if ((sha1(sha1($password2).$strSalt)) == $hash){
            return true;
        return false;