Attempting to start a session outside xenforo, seems to not be creating a valid cookie

I am trying to recreate a login form to be used outside of xenforo to log users into my forum. As of right now I am posting the credentials to xenforo's index.php?login/login script and everything seemingly works fine until I leave the forum and return to the codeigniter section of the site. This closes the session and when I revisit the forum I am no longer logged in. I'm not sure if this has something to do with the cookie not being generated properly? I looked through /library/XenForo/ControllerPublic/login.php and a few other related files to try to peel away why it doesn't want to work... but to no avail. Has anyone else attempted this or have insight on how to accomplish this?

Website -
demo login for testing - username "demo", password "demo"

<form action="" class="signin" method="post">
     <input type="text" name="login" title="Email" placeholder="Email or Full name" autocomplete="on">
     <input type="password" name="password" title="Password" placeholder="Password">
     <button type="submit" class="submit button">Sign in</button>
     <input type="hidden" name="remember" value="1">
     <input type="hidden" name="register" value="0" />
     <input type="hidden" name="cookie_check" value="1" />
     <input type="hidden" name="redirect" value="" />
     <input type="hidden" name="_xfToken" value="" />


That's the way I handled by Vbulletin integration but I wanted to take it a step further this time:

I use xenforo's own functions with my cakephp application to process the login.

A few posts in that thread might be of use to yourself

There was also this thread:

Where someone actually created a code igniter class to authenticate the user session. I based my CakePHP equivalent off that. I also added some tidbits to the end of that thread on how to do a few bits that I'd found out.