1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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

Discussion in 'XenForo Development Discussions' started by Shawn Craine, Jun 27, 2011.

  1. Shawn Craine

    Shawn Craine Member

    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 - trackstance.net
    demo login for testing - username "demo", password "demo"

    Code:
    <form action="http://trackstance.net/forum/index.php?login/login" 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="http://trackstance.net/forum/index.php" />
         <input type="hidden" name="_xfToken" value="" />
    </form>
    
     
  2. Rjs37

    Rjs37 Member

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

    http://xenforo.com/community/threads/user-class.16846/page-2#post-222724

    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:
    http://xenforo.com/community/threads/using-xenforo-permission-outside-of-xenforo.7585/

    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.
     

Share This Page